我试图建立一个maven父pom设置,我不必在我的孩子pom中声明任何插件信息,一切都取自父pom.
我基本上把它放在我将所有插件都配置到父pom中的地方.然后在子poms我必须声明插件仍然,但没有版本和配置信息.
我根本不想在孩子中声明插件.通过这种方式,我可以向我的父pom添加新功能(例如pmd,freebugs等),现在我的所有项目都可以使用它们.我怎么能做到这一点?
父Pom
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.0</version>
<inherited>true</inherited>
<configuration>
<providerImplementations>
<cvs>cvs_native</cvs>
</providerImplementations>
<systemProperties>
<property>
<name>maven.scm.perforce.clientspec.name</name>
<value>${perforceClientSpec}</value>
</property>
</systemProperties>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
Child Pom仍然需要这个,但如果我可以避免,我不想这样做:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我通过Maven运行PMD 2.现在我已经准备好所有规则集以查看生成的内容(请参阅下面的代码).我正在修复那些对我来说有意义的事情.但是,有一些情况,例如在"优化"规则集中,我希望保留规则集,但只禁用规则集中的一个规则.在我的情况下,我想禁用"AvoidInstantiatingObjectsInLoopss"规则.
这是我的pom.xml的报告部分
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.6</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>${pmd.minimumTokens}</minimumTokens>
<failOnViolation>${pmd.failOnViolation}</failOnViolation>
<targetJdk>${projectTargetJdk}</targetJdk>
<rulesets>
<!-- See the FAQ here: http://maven.apache.org/maven-1.x/plugins/pmd/faq.html -->
<!-- See the rule sets here: http://pmd.sourceforge.net/ (menu on the left has a Rule Sets section -->
<!-- Unused rule sets -->
<!-- <ruleset>/rulesets/naming.xml</ruleset> -->
<!-- Unable to find rule sets -->
<!-- <ruleset>/rulesets/emptycode.xml</ruleset> -->
<!-- <ruleset>rulesets/comments.xml</ruleset> -->
<!-- <ruleset>/rulesets/unnecessary.xml</ruleset> -->
<!-- <ruleset>/rulesets/logging.xml</ruleset> -->
<!-- used rule sets …Run Code Online (Sandbox Code Playgroud)