Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /usr/share/maven
Java version: 1.6.0_37, vendor: Apple Inc.
Description
The attached test project uses Tycho 0.16 to build an OSGi bundle than uses CAL10N. Unfortunately, the maven-cal10n-plugin:verify goal doesn't work with this setup:
[ERROR] Failed to execute goal ch.qos.cal10n.plugins:maven-cal10n-plugin:0.7.4:verify (verify) on project example: Failed to instantiate MessageKeyVerifier class: InvocationTargetException: Failed to find enum class [Messages] -> [Help 1]
Here's my diagnosis of what's going wrong: While in VerifyMojo.buildClassLoader() the target/classes folder is added to the classpath of the ThisFirstClassLoader, it is never used when looking for the enum. The reason for this is as follows: Tycho doesn't populate the ${project.artifacts} property with the project's dependencies (which are managed in the MANIFEST.MF rather than the pom.xml). Thus, VerifyMojo.getMessageKeyVerifierInstance(..) picks up the MessageKeyVerifier from the plugin's classpath rather than the one just constructed for the ThisFirstClassLoader and subsequently fails to load the Messages.class with its defining class loader (= the plugin classloader).
While arguably Tycho injecting an empty list for ${project.artifacts} looks like a a problem on the Tycho side (we will report this there as well), the fact that under certain circumstances the ThisFirstClassLoader is not used to access target/classes looks unintentional/like a bug.