|
First reported by a Sonatype customer, and researched and patched by Benjamin Bentmann of Sonatype - the findbugs-maven-plugin can cause the following error when both the build and site lifecycles are executed in the same build execution using maven 2.2.1.
It seems findbugs loses the correct classloader from which to load it's classes from.
This occurs when executing a site report using the "findbugs:findbugs" goal in the same build execution as when the "findbugs:check" goal executes as part of the regular build lifecycle.
For example: mvn clean install site
...where verify phase triggers the check goal and site builds the findbugs report.
One workaround is to split to two mvn invocations, one for the "verify" phase and another for the "site" phase, might work around the issue. However this is a poor solution as it does not workaround the case where deploy is executed by the release plugin using the standard mvn release:prepare release:perform.
Attached is a patch originally by Bentmann, which fixed the problem for the customer. Also I have attached a test project which reproduces the problem every time without the patch. Execute the attached project with "mvn clean verify site" using Maven 2.2.1 ( Note: it will not fail with Maven 3 )
artifact - the project that reproduces the failure when the project is built using "mvn clean verify site"
btw - The artifact pom.xml is a quickly hacked up version that may not need all the stuff in it to reproduce the problem, however I lacked time to fully minimize it.
|