2015-01-06 5 views
3

여러 exec-maven-plugin 실행을 어떻게해서든지 병렬로 실행할 수 있습니까?여러 개의 maven-exec-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> 

실제 배포에 대한 각각의 구성은 물론 더 복잡하지만 당연히 문제가되는 특정 질문과 관련이 없습니다.

+0

어떤 Maven 버전을 사용하십니까? 지금까지 뭐 해봤 어? 'mvn -T 2.0 ...'을 실행하려고 시도 했습니까? – khmarbaise

+1

여러 모듈/프로젝트를 병렬로 실행/구축하기위한 것입니다. 나는 그것을 찾고 있지 않다. 내가 필요한 것은 동일한 모듈/프로젝트에서 여러개 (java) 실행 파일을 실행하고 같은 단계에서 병렬로 실행하는 것이다. – mac

답변

0

백그라운드에서 Java 프로그램을 시작하는 셸 스크립트를 사용할 수 있습니다. 처럼이 쉘 스크립트는 볼 수 : 인수로 com.example.DeployDBTypeTwo를 사용할 수있는 pom.xml 파일에서

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

.

<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> 
관련 문제