我尝试使用一些参数来执行一个shell脚本(实际上它是OpenLDAP的ldapmodify )。这就是我在pom.xml中所做的:
在Maven配置文件中,我定义了一些值
<profile>
<id>Linux-OpenLDAP</id>
<activation>
<os>
<family>Unix</family>
</os>
</activation>
<properties>
<OpenLdap.ClientTools.home></OpenLdap.ClientTools.home>
<executable>/usr/local/bin/ldapmodify</executable>
<argument>-a -x -h localhost -p 389 -D "cn=manager,dc=my-domain,dc=com" -f ${test-users.idif.path} -w secret</argument>
</properties>
</profile>我就是这样使用exec-maven-plugin的:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${executable}</executable>
<arguments>
<commandlineArgs>${argument}</commandlineArgs>
</arguments>
</configuration>
</execution>
</executions>
</plugin>然后,在mvn install之后,我得到了以下错误:
[INFO] --- exec-maven-plugin:1.4.0:exec (default) @ entity-matching-bootstrap ---
/usr/local/bin/ldapmodify: invalid option -- ' '
ldapmodify: unrecognized option -
Add or modify entries from an LDAP server如果我在逗号线上直接运行/usr/local/bin/ldapmodify -a -x -h localhost -p 389 -D "cn=manager,dc=ibm,dc=com" -f /home/entity-matching/entity-matching-bootstrap/src/test/resources/test_users.ldif -w secret,它就会成功。那么,为什么该选项在mvn安装期间无效?
发布于 2018-10-22 18:15:00
问题在于您将<commandlineArgs>嵌入到<arguments>部分中。只需重新设置<arguments>部分:
<configuration>
<executable>${executable}</executable>
<commandlineArgs>${argument}</commandlineArgs>
</configuration>https://stackoverflow.com/questions/52934990
复制相似问题