2014-04-03 46 views
0

我的多模塊項目的結構如下:Maven的多模塊和插件調用

parent 
module 1 <-- inherits from parent via <relativePath>../parent/pom.xml</relativePath> 
module 2 <-- inherits from parent via <relativePath>../parent/pom.xml</relativePath> 
aggregator <-- aggregates modules with <modules><module> 

聚合器調用以下插件:

<build> 
<plugins> 
    <plugin> 
     <groupId>org.jacoco</groupId> 
     <artifactId>jacoco-maven-plugin</artifactId> 
     <executions> 
      <execution> 
       <id>jacoco-initialize</id> 
       <goals> 
        <goal>prepare-agent</goal> 
       </goals> 
       <configuration> 
        <destFile>some path</destFile> 
       </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <append>true</append> 
     </configuration> 
    </plugin> 
</plugins> 
</build> 

該插件呼籲聚合,但我想爲所有模塊(1和2)調用它。

我知道我可以更改父pom,但我想保持它乾淨(該更改是更大實現的一部分)。

是否有可能以這種方式配置插件,它要求所有模塊(就像放在父pom中一樣)?

回答

0

總之:第

爲模塊獲得在自己的POM沒有定義生命週期插件的唯一方法是通過從其父繼承的配置。

您應該真的考慮將父項和聚合器合併到一個項目中,即使aggegrator也是父項。這樣更清潔。