Is it possible to run multiple maven-exec-plugin executions in parallel?

大城市里の小女人 提交于 2019-12-05 14:52:27

You can use a shellscript that starts the Java program on the background. This shellscript can look like:

#!/bin/bash
echo Starting dbtype-deployment $* on the background
java $* >/dev/null 2>&1 &

In your pom.xml you can use com.example.DeployDBTypeTwo as an argument.

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

Setup the project with two modules:

  1. Module 1 - for plugin first-dbtype-deployment Module
  2. for plugin second-dbtype-deployment and do not create dependencies between these and then execute parent project with multiple threads:

Example: mvn -T 4 clean install # Builds with 4 threads https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!