[ http://jira.codehaus.org/browse/MNG-2173?page=comments#action_61868 ]
John Allen commented on MNG-2173:
---------------------------------
Note that a work around for this issue is to configure the reporting plugins
and their dependencies as part of your build in the <pluginsManagement> section
of your POM, as they are reporting plugins they wont bind to a lifecycle phase
(well PMD and checkstyle dont) and will thus be dormant in a normal build.
However due to the way maven does things (a nice way of saying a bug depending
upon perspective) when you run site:site the plugins referenced by <reporting>
will use their <pluginsManagement> configured dependencies and will thus find
resources in the custom jars youve specified.
Note, if youre activating the reporting plugins via a <profile> in a child POMs
you need to (pre)configure those reporting plugins in the <build><plugins>
section of your parent POM rather than the <pluginsManagement> section due to
another bug that prevents specified depenedencies from being picked up in child
POMs when activated from <profiles>.
Extract from my parent POM:-
<build>
<plugins>
<!-- Maven bug workaround: plugins used in the
<reporting> section can not have
<dependencies> specified (JIRA MNG-2173) and as
there is no <reportingManagement> section
we can not set them up in a parent POM (JIRA
MNG-1931) so we need to configure
these reporting plugins as if they were part of
the build even though they are only used
in reporting so they can access their required
dependencies. (fortunately they do
not bind themselves to a lifecycle stage so
they do not get run in the normal build) -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<dependencies>
<dependency>
<artifactId>pmd</artifactId>
<groupId>com.fujitsu.abs.build-resources</groupId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<rulesets>
<ruleset>pmd-fujitsu.xml</ruleset>
</rulesets>
<format>xml</format>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.fujitsu.abs.build-resources</groupId>
<artifactId>checkstyle</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<outputFileFormat>xml</outputFileFormat>
<xrefLocation>xref</xrefLocation>
<configLocation>checkstyle-fujitsu.xml</configLocation>
</configuration>
</plugin>
</plugins>
Usage in my child POM:-
<reporting>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputFileFormat>xml</outputFileFormat>
<xrefLocation>xref</xrefLocation>
<configLocation>checkstyle-fujitsu.xml</configLocation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<rulesets>
<ruleset>pmd-fujitsu.xml</ruleset>
</rulesets>
<format>xml</format>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
</configuration>
</plugin>
[SNIP]
<profile>
<!-- these profile adds code quality tests to the build
lifecycle,
any failure to meet the defined standards will
result in the build
failing -->
<id>enableGovernanceChecks</id>
<activation>
<property>
<name>abs.enableGovernanceChecks</name>
<value>true</value>
</property>
</activation>
<build>
<!-- there's a maven bug that results in a NPE
if we dont have specify of these (JIRA: ???) -->
<pluginManagement />
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<!-- This shouldnt be
necessary as the checkstyle plugin is configured by a parent
project however
due to a maven bug (JIRA: MNG-2174) the plugin's dependencies are not
propogated to
child projects so we need to restate the dependency here -->
<dependency>
<artifactId>checkstyle</artifactId>
<groupId>com.fujitsu.abs.build-resources</groupId>
<!-- Due to a
maven bug (JIRA: MNG-2172) the version info for plugin dependencies
can not
be specified in the <dependencyManagement> section so we must
explicitly specify the <version> to use here -->
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>standards-conformance</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<dependencies>
<dependency>
<artifactId>pmd</artifactId>
<groupId>com.fujitsu.abs.build-resources</groupId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>standards-conformance</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clover-plugin</artifactId>
<executions>
<execution>
<id>standards-conformance</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
> support <dependencies> in <reporting> plugins
> ---------------------------------------------
>
> Key: MNG-2173
> URL: http://jira.codehaus.org/browse/MNG-2173
> Project: Maven 2
> Type: Bug
> Components: Plugins and Lifecycle
> Reporter: John Allen
>
>
> Inconsistency with rest of design.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
