如何使用Maven exec运行asadmin部署 [英] How to use maven exec to run asadmin deploy
问题描述
我正在使用Mac OS 10.5.8和Maven 3.0.3.
I'm using Mac OS 10.5.8 and Maven 3.0.3.
如果我从命令行运行此命令,它将起作用:
If I run this command from the command line, it works:
asadmin deploy --user admin --type ejb --libraries pedra-signon-ejb-1.0.jar target/my-ejb-1.0.jar
但是,如果我尝试使用Maven Exec插件(mvn exec:exec
)执行以下命令,则具有以下配置:
But if I try executing this same command with Maven Exec Plugin (mvn exec:exec
), with these configurations:
<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.
CLI019 Invalid number of operands. Number of operands should be equal to 1.
但在它失败之前,它记录以下行:
but just before it fails, it logs this line:
[DEBUG]执行命令行:asadmin deploy --user admin --type ejb --libraries pedra-signon-ejb-1.0.jar target/my-ejb-1.0.jar
[DEBUG] Executing command line: asadmin deploy --user admin --type ejb --libraries pedra-signon-ejb-1.0.jar target/my-ejb-1.0.jar
与我手动执行的命令相同.
which is the same command that I executed manually.
如何使用Maven Exec插件执行此命令?
How can I execute this command using Maven Exec plugin?
如果我删除<argument>deploy</argument>
并将<executable>asadmin</executable>
更改为<executable>asadmin deploy</executable>
,maven将失败,并显示"asadmin deploy:not found".
If I delete <argument>deploy</argument>
and change <executable>asadmin</executable>
to <executable>asadmin deploy</executable>
maven fails with "asadmin deploy: not found".
推荐答案
在maven配置中,命令选项(例如--user,-type)需要在它们和它们的值之间使用=字符,如下所示:
The command options, such as --user, --type, in the maven configuration need to have an = character between them and their values, like this:
<argument>--user=admin</argument>
<argument>--type=ejb</argument>
<argument>--libraries=pedra-signon-ejb-1.0.jar</argument>
这篇关于如何使用Maven exec运行asadmin部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!