[
http://jira.codehaus.org/browse/MJAVADOC-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160215#action_160215
]
Kay Schubert commented on MJAVADOC-221:
---------------------------------------
We have the same problem. In our case I could trace back the actual origin to
the "dependencies"-report of maven-project-info-reports-plugin, specificially
org.apache.maven.report.projectinfo.dependencies.Dependencies.mapArtifactFiles(org.apache.maven.shared.dependency.tree.DependencyNode,
java.util.Map), line "anode.getArtifact().setFile( projartifact.getFile() );".
The culprit is when anode.getArtifact() returns the main jar-artifact, and
projartifact is the test-jar-artifact. As you can see, the main jar-artifact's
file name is set to that of the test-jar-artifact.
As expected the problem disappeared after removing the "dependencies"-report
from the reportSet.
I didn't look any deeper into Dependencies.mapArtifactFiles, so I can't say
anything about its correctness. Regardless of that I would suggest that
org.apache.maven.report.projectinfo.DependenciesReport.executeReport(java.util.Locale)
should pass cloned artifacts to
org.apache.maven.report.projectinfo.dependencies.Dependencies, not the
originals.
> 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