4

複数の 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>

もちろん、実際の展開のそれぞれの構成はより複雑ですが、それは問題になっている特定の質問には関係ないと思います。

4

2 に答える 2

0

バックグラウンドで Java プログラムを起動するシェルスクリプトを使用できます。このシェルスクリプトは次のようになります。

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

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>
于 2015-01-21T09:48:34.487 に答える