首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >exec-maven-plugin不能正确使用参数。

exec-maven-plugin不能正确使用参数。
EN

Stack Overflow用户
提问于 2018-10-22 17:49:22
回答 1查看 403关注 0票数 1

我尝试使用一些参数来执行一个shell脚本(实际上它是OpenLDAP的ldapmodify )。这就是我在pom.xml中所做的:

在Maven配置文件中,我定义了一些值

代码语言:javascript
复制
<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的:

代码语言:javascript
复制
        <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之后,我得到了以下错误:

代码语言:javascript
复制
[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安装期间无效?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-22 18:15:00

问题在于您将<commandlineArgs>嵌入到<arguments>部分中。只需重新设置<arguments>部分:

代码语言:javascript
复制
<configuration>
  <executable>${executable}</executable>
  <commandlineArgs>${argument}</commandlineArgs>
</configuration>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52934990

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档