Maven 3 has been out for a bit, and of course with some changes. Other than changing versions of plug-ins and extensions, I think the biggest change has been in the way site reporting plugins are configured. Maven 3 no longer uses /project/reporting/plugins/plugin to configure report plugins. It uses /project/build/plugins/plugin[groupId=”org.apache.maven.plugins” and artifactId=”maven-site-plugin”]/configuration/reportPlugins/plugin or /project/build/pluginManagement/plugins/plugin[groupId=”org.apache.maven.plugins” and artifactId=”maven-site-plugin”]/configuration/reportPlugins/plugin.
Now, what happens to plug-in dependencies? Like when you need to introduce a resource plug-in for say the checkstyle plug-in for custom checkstyle configuration[1]. Adding dependencies to the individual reportPlugins will cause a build failure with a large exception trace! The reason – ReportPlugin[2] does not have a dependency or dependencies field. Adding dependencies to the same plug-in under /project/build/plugins/plugin or /project/build/pluginManagement/plugins/plugin does not help – the dependencies do not get carried over to the site generation phase.
The solution: add the dependencies to the site plug-in itself.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<generateSitemap>true</generateSitemap>
<reportPlugins>
<!-- See http://maven.apache.org/plugins/maven-site-plugin-3.0-beta-3/maven-3.html -->
<!-- Other report plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>infix/checkstyle/infix-checks.xml</configLocation>
</configuration>
</plugin>
</reportPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>com.mindtree.techworks.infix.plugins-common</groupId>
<artifactId>infix-build-configs</artifactId>
<version>${infix.pluginscommon.version}</version>
</dependency>
</dependencies>
</plugin>
It is simple… but it works š
[1] http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html
[2] http://svn.apache.org/viewvc/maven/plugins/tags/maven-site-plugin-3.0-beta-3/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java?view=markup
Discussion
No comments yet.