test-scoped dependencies sometimes used instead of compile-scoped if group and artifact are the same ----------------------------------------------------------------------------------------------------
Key: MJAVADOC-221 URL: http://jira.codehaus.org/browse/MJAVADOC-221 Project: Maven 2.x Javadoc Plugin Issue Type: Bug Affects Versions: 2.5 Environment: Maven 2.0.9, WinXP and Redhat Linux Reporter: Jeff Mills Priority: Minor 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> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira