也许你应该将你的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