mac*_*mac 5 maven-plugin maven exec-maven-plugin
是否可以以某种方式并行运行多个 exec-maven-plugin 执行?
我们希望为 DAL 集成测试部署不同的数据库类型,虽然显然可以按顺序执行此操作,但这会浪费大量时间。
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>first-dbtype-deployment</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.example.DeployDBTypeOne</mainClass>
</configuration>
</execution>
<execution>
<id>second-dbtype-deployment</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.example.DeployDBTypeTwo</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</build>
Run Code Online (Sandbox Code Playgroud)
实际部署的相应配置当然更复杂,但我认为这与所涉及的特定问题无关。
您可以使用 shellscript 在后台启动 Java 程序。这个 shell 脚本可能看起来像:
#!/bin/bash
echo Starting dbtype-deployment $* on the background
java $* >/dev/null 2>&1 &
Run Code Online (Sandbox Code Playgroud)
在 pom.xml 中,您可以使用 com.example.DeployDBTypeTwo 作为参数。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>dbtype-deployment-x</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>startjava.sh</executable>
<workingDirectory>${project.build.directory}/youKnowBest</workingDirectory>
<arguments><argument>com.example.DeployDBTypeTwo</argument></arguments>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3948 次 |
| 最近记录: |