如何使用maven执行多个cmd命令?

时间:2014-02-27 11:20:21

标签: java maven build pom.xml

我想使用单CMD

在maven中运行多个pom.xml.命令

我可以知道我该怎么做?

例如

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

2 个答案:

答案 0 :(得分:0)

您可以为cmd1和cmd2引入两个不同的profiles

答案 1 :(得分:0)

也许exec-maven-plugin

运行一个将按顺序运行cmds的脚本::

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.2</version>
          <executions>
            <execution>
              <id>run a backup</id>
              <phase>pre-integration-test</phase>
              <goals>
                <goal>exec</goal>
              </goals>
              <configuration>
                <executable>/path/to/backup-script/bkp.sh</executable>
              </configuration>
            </execution>
          </executions>
        </plugin>
相关问题