Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7.1, 3.0
-
None
-
None
-
Patch
Description
Using the maven-pmd-plugin during a parallel maven build can produce the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:2.8-SNAPSHOT:pmd (pmd) on project <projectname>: An error has occurred in PMD Report report generation. Could not find the template 'org/apache/maven/doxia/siterenderer/resources/default-site.vm: NullPointerException -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Reproducibility of this problem appears to be based on the reactor structure and how parallelizable it is. I will try to create a test case that reproduces this problem consistently. At times it is 100% reproducible, but then a small change to the reactor configuration (eg. add a project) will cause the error to disappear.
I believe that this bug is caused by thread safety issues in the velocity library that is used by doxia.
Upgrading doxia dependencies to version 1.3 appears to resolve this bug. Although the version of velocity used by doxia 1.3 is still the same, velocity-tools been introduced.
In version 1.3, instead of newing the VelocityContext directly, doxia-site-renderer uses ToolManager.getContext, which delegates to ToolboxFactory to do some initialization. This initialization logic is protected with synchronization, which may explain why the bug seems to go away after the upgrade.
I've included a patch that applies against trunk of the maven-pmd-plugin which upgrades doxia from version 1.1.3 to 1.3.