Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Not A Problem
-
2.5
-
None
-
None
-
None
-
Maven 2.0.9, WinXP and Redhat Linux
Description
I had a build failing because of unresolved classes, but only in the javadoc:javadoc goal, not when compiling. Debugging showed that the classpath excluded some expected compile-scoped dependencies and replaced them with the test-scoped dependencies that have the same group and artifact IDs but different classifier ("tests").
We have a few modules for which we use the jar:test-jar goal to package the unit test code for re-use by other modules. So the dependent modules specify 2 dependencies: group:artifact with compile scope and group:artifact:classifer with test scope. What I discovered was that this plugin uses the one that is specified last, regardless of whether its scope is compile or test. IOW, I fixed my build by moving my test-scoped dependencies to be before the compile-scoped dependencies.
Example resulting in test jar (moduleA-version-tests.jar) in classpath instead of the main jar (moduleA-version.jar):
<dependency>
<groupId>com.company.group</groupId>
<artifactId>moduleA</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.company.group</groupId>
<artifactId>moduleA</artifactId>
<classifier>tests</classifer>
<scope>test</scope>
</dependency>
Example resulting in correct classpath:
<dependency>
<groupId>com.company.group</groupId>
<artifactId>moduleA</artifactId>
<classifier>tests</classifer>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.company.group</groupId>
<artifactId>moduleA</artifactId>
<scope>compile</scope>
</dependency>
Attachments
Issue Links
- relates to
-
MPIR-146 org.apache.maven.report.projectinfo.dependencies.Dependencies.mapArtifactFiles(DependencyNode, Map) wreaks havoc upon artifacts file names
- Closed