【发布时间】:2019-03-26 20:40:57
【问题描述】:
我尝试使用一些参数执行一个 shell 脚本(实际上是 OpenLDAP 的 ldapmodify)。这就是我在 pom.xml 中所做的:
在 Maven Profile 中我定义了一些值
<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 install 时该选项无效呢?
【问题讨论】:
标签: maven openldap exec-maven-plugin