Java 如何使用maven执行多个cmd命令?
我想使用单个pom.xml在maven中运行多个CMD命令 我可以知道我怎么做吗 比如说Java 如何使用maven执行多个cmd命令?,java,maven,build,pom.xml,Java,Maven,Build,Pom.xml,我想使用单个pom.xml在maven中运行多个CMD命令 我可以知道我怎么做吗 比如说 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <ex
<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引入两种不同的版本。可能: 运行将按顺序运行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>
那有什么问题?它起作用还是不起作用?除此之外,为什么需要在构建中执行特定于操作系统的操作?某种测试?如果是,安装阶段看起来是错误的。否,这只是一个例子。我想在构建项目时运行grunt命令。我不确定,但这可能是更好的解决方案:不,不是这样,只是一个例子。我想使用cmd运行一个grunt命令