【问题标题】:How to use maven exec to run asadmin deploy如何使用 maven exec 运行 asadmin deploy
【发布时间】:2013-05-14 02:10:32
【问题描述】:

我使用的是 Mac OS 10.5.8 和 Maven 3.0.3。

如果我从命令行运行此命令,它会起作用:

asadmin deploy --user admin --type ejb --libraries pedra-signon-ejb-1.0.jar target/my-ejb-1.0.jar

但如果我尝试使用 Maven Exec 插件 (mvn exec:exec) 执行相同的命令,并使用以下配置:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <executable>asadmin</executable>
                <arguments>
                    <argument>deploy</argument>
                    <argument>--user admin</argument>
                    <argument>--type ejb</argument>
                    <argument>--libraries pedra-signon-ejb-1.0.jar</argument>
                    <argument>target/${project.build.finalName}.jar</argument>
                </arguments>
            </configuration>
        </plugin>

它失败了:

CLI019 操作数数量无效。操作数的数量应该相等 到 1。

但就在它失败之前,它会记录这一行:

[DEBUG] 执行命令行:asadmin deploy --user admin --type ejb --libraries pedra-signon-ejb-1.0.jar 目标/my-ejb-1.0.jar

这与我手动执行的命令相同。

如何使用 Maven Exec 插件执行此命令?

如果我删除 &lt;argument&gt;deploy&lt;/argument&gt; 并将 &lt;executable&gt;asadmin&lt;/executable&gt; 更改为 &lt;executable&gt;asadmin deploy&lt;/executable&gt; maven 失败并显示“asadmin deploy: not found”。

【问题讨论】:

    标签: maven exec-maven-plugin asadmin


    【解决方案1】:

    maven配置中的命令选项,比如--user,--type,需要在它们和它们的值之间有一个=字符,像这样:

    <argument>--user=admin</argument>
    <argument>--type=ejb</argument>
    <argument>--libraries=pedra-signon-ejb-1.0.jar</argument>
    

    【讨论】:

      猜你喜欢
      • 2012-09-15
      • 2021-12-28
      • 2016-10-17
      • 2016-01-31
      • 1970-01-01
      • 2018-04-12
      • 1970-01-01
      • 2011-07-03
      • 2020-01-25
      相关资源
      最近更新 更多