How to use maven exec to run asadmin deploy

我只是一个虾纸丫 提交于 2019-12-12 01:04:28

问题


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

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>

it fails with:

CLI019 Invalid number of operands. Number of operands should be equal to 1.

but just before it fails, it logs this line:

[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.

How can I execute this command using Maven Exec plugin?

If I delete <argument>deploy</argument> and change <executable>asadmin</executable> to <executable>asadmin deploy</executable> maven fails with "asadmin deploy: not found".


回答1:


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>


来源:https://stackoverflow.com/questions/16528234/how-to-use-maven-exec-to-run-asadmin-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!