也許你應該將你的root pom分成兩個獨立的實體:parent pom和aggregator pom。你的聚合器pom甚至可能繼承父pom。
如果您下載hibernate的最新項目佈局,您將看到這個設計模式正在運行。
完成分離後,您可以在aggregator/root pom中定義並執行checkstyle插件。因爲它不再是你的子模塊的父親,它不會被它們繼承。
編輯
使用<relativePath>
聲明只是爲了演示<parent>
時,下面是從Hibernate項目結構採取的一個例子。
整個分佈可以發現這裏 - >http://sourceforge.net/projects/hibernate/files/hibernate3
正是如此,你有一些背景,這裏是他們的目錄佈局的一個子集
project-root
|
+-pom.xml
|
+ parent
| |
| +-pom.xml
|
+ core
|
+-pom.xml
.. rest is scipped for brevity
項目根/ pom.xml的片段
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<version>3.5.4-Final</version>
<relativePath>parent/pom.xml</relativePath>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<packaging>pom</packaging>
<name>Hibernate Core Aggregator</name>
<description>Aggregator of the Hibernate Core modules.</description>
<modules>
<module>parent</module>
<module>core</module>
項目根/父/ pom.xml的片段
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<packaging>pom</packaging>
<version>3.5.4-Final</version>
項目根/核心/ pom.xml的片段
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<version>3.5.4-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<packaging>jar</packaging>
謝謝,建議真的很好,但現在還有另一個問題。我的根/聚合器項目不能從「父項目」繼承,因爲它是_under_root,並且在第一個建設週期中不可用。任何想法? – yegor256 2010-08-05 12:26:44
@ FaZend.com我已經添加了一些示例。 – 2010-08-05 13:50:46
這不是必需的,你可以告訴maven不要繼承插件配置。 – 2010-08-06 15:42:45