How to use maven exec to run asadmin deploy
Asked Answered
A

1

0

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

Agnola answered 13/5, 2013 at 17:57 Comment(0)
A
0

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>
Agnola answered 13/5, 2013 at 18:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.