how to execute multiple command prompt commands us

2019-06-01 18:18发布

I want to run multiple command prompt commands in maven using single pom.xml. How can I do that?

For ex: I have 2 commands to execute. I am executing the first command by using exec-maven-plugin. Below is the portion of my pom.xml to execute the first command:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <id>load files</id>
            <phase>install</phase>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
    <configuration>

        <executable>windchill</executable>
        <arguments>
            <argument>wt.load.LoadFileSet</argument>
            <argument>-file</argument>
            <argument>${basedir}/fileSet.xml</argument>
            <argument>-UNATTENDED</argument>
            <argument>-NOSERVERSTOP</argument>
            <argument>-u</argument>
            <argument>wcadmin</argument>
            <argument>-p</argument>
            <argument>wcadmin</argument>
        </arguments>

    </configuration>
</plugin>

For this the build is success. Is it possible to execute one more command just like above in the same pom.xml? I was not able to do that. So someone please help how to add it in pom.xml

2条回答
Fickle 薄情
2楼-- · 2019-06-01 18:34

Then you specify execution ids as:

mvn exec:exec@id2

But this syntax is possible starting from maven 3.3.1

查看更多
干净又极端
3楼-- · 2019-06-01 18:38

The answer can be found in the FAQ. The full answer is here: http://article.gmane.org/gmane.comp.java.maven-plugins.mojo.user/1307

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <id>id1</id>
            <phase>install</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>cmd1</executable>
            </configuration>
        </execution>
        <execution>
            <id>id2</id>
            <phase>install</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>cmd2</executable>
            </configuration>
        </execution>
    </executions>
</plugin>
查看更多
登录 后发表回答