2016-12-03 7 views
1

マイプロジェクトを投写​​するには、以下の構造を有する:POMの父親と2つの子供のPOMSはのMaven:子供のドッカーイメージを構築すること

pom.xml 
    | 
    x----child1 
    |  | 
    |  x----pom.xml 
    | 
    x----child2 
     | 
     x----pom.xml 

があります。子供たちのビルドはSpotify Pluginを使ってプロジェクトのDockerイメージを生成します。私の質問は、ルートディレクトリから両方のビルドを起動する方法です。私は基本的に子供たちのモジュール上に構築されたspotifyプラグインを呼び出す必要があります。 は私が

mvn clean install 

を使用しようとしたが、子どもたちはのmaven-コンパイラプラグインではなく、ドッキングウィンドウ-のmaven-pluginので構築されています。私はすでにこのようなモジュールを定義しポンポンの父で

<build> 
    <plugins> 
     <plugin> 
      <groupId>com.spotify</groupId> 
      <artifactId>docker-maven-plugin</artifactId> 
      <version>${spotify.plugin.version}</version> 
      <configuration> 
       <imageName>childImage</imageName> 
       <dockerDirectory>${project.build.directory}/../src/docker</dockerDirectory> 
       <resources> 
        <resource> 
         <targetPath>/</targetPath> 
         <directory>${project.build.directory}</directory> 
         <include>${project.build.finalName}.jar</include> 
        </resource> 
       </resources> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

これは、私が子供に使用ビルドです。

<modules> 
     <module>child1</module> 
     <module>child2</module> 
    </modules> 

ありがとうございました!プラグインに次を追加

答えて

0

あなたがこの問題に取り組むためのオプションのカップルを持っている:

  1. スキップする親ポンポンのセクションでプラグインを設定するが、プラグインの設定をデフォルトドッカーがビルドし、スキップしないように子モジュールでオーバーライドします。
  2. 子モジュールでのみ設定し、ビルドゴールをパッケージフェーズにバインドします。

私は、子のpom.xmlに以下と[2]を使用している:

<build> 
    <plugins> 
    ... 
    <plugin> 
     <groupId>com.spotify</groupId> 
     <artifactId>docker-maven-plugin</artifactId> 
     <version>0.4.13</version> 
     <executions> 
     <execution> 
      <goals> 
      <goal>build</goal> 
      </goals> 
      <phase>package</phase> 
     </execution> 
     </executions> 
     <configuration> 
     <imageName>example</imageName> 
     <baseImage>example</baseImage> 
     <resources> 
      <resource> 
      <targetPath>/</targetPath> 
      <directory>target</directory> 
      <include>example.war</include> 
      </resource> 
     </resources> 
     </configuration> 
    </plugin> 
    ... 
    </plugins> 
</build> 
0

試してみてください。

<executions> 
    <execution> 
     <phase>install</phase> 
     <goals> 
      <goal>build</goal> 
     </goals> 
    </execution> 
</executions> 
関連する問題