简体   繁体   中英

How to execute multiple cmd commands using maven?

I want to run multiple CMD commands in maven using single pom.xml.

May I know how can I do that?

for example

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

您可以为cmd1和cmd2引入两个不同的配置文件

Maybe exec-maven-plugin :

run a script that will run your cmds sequentially::

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM