[jira] Commented: (MNG-3890) Transitive dependencies override explicitly set scope.
[ http://jira.codehaus.org/browse/MNG-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=164457#action_164457 ] Torben S. Giesselmann commented on MNG-3890: The problem seems to be that artifacts of {{provided}} scope are excluded from dependency resolution right from the start. Here's the code in {{DefaultArtifactFactory}}: {code} private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ) { // TODO: can refactor - inherited scope calculation belongs in the collector, use scope handler String desiredScope = Artifact.SCOPE_RUNTIME; if ( inheritedScope == null ) { desiredScope = scope; } else if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_PROVIDED.equals( scope ) ) { return null; } ... } {code} If the {{provided}} dependencies don't show up, then there's no way telling what must finally be excluded from the dependency tree. The {{DefaultArtifactCollector}} does everything right in recursively drilling down to {{test --> c --> b --> a}} and adding all dependencies it finds. However, after all children of a {{ResolutionNode}} have been processed, all dependencies of scope {{runtime}} or {{provided}} should be removed from the list of resolved artifacts. Or at least be added to some sort of exclusion filter. > Transitive dependencies override explicitly set scope. > -- > > Key: MNG-3890 > URL: http://jira.codehaus.org/browse/MNG-3890 > Project: Maven 2 > Issue Type: Bug > Components: Dependencies >Affects Versions: 2.0.9, 2.1.0-M1, 3.0-alpha-1 >Reporter: Stephan Kleine >Priority: Critical > Fix For: 2.0.11 > > Attachments: MMG-3890-core-it-suite.patch, testcase.tar.bz2 > > > Transitive dependencies override explicitly set scope. > E.g. a project A depends on "Hibernate" with default scope and a project B > depends on project A as well as on "Hibernate" for which it sets the scope > explicitly to "provided". Further an EAR project C depends on project B (see > the attached testcase). > Now I would expect that C does not contain any jars for Hibernate and its > dependencies since B explicitly set the scope to "provided". Sadly this is > not the case and C contains all hibernate jars. The only way around this I > have found is setting the scope to "provided" for Hibernate in A as well - > which is just a crude hack that produces other issues. > IMHO this is a bug because Maven should respect the overridden dependency > scope since the current way forces me to set the scope to provided in A which > is just wrong. > Please try to get this fixed for 2.10 or 2.1 since it's a real pita atm. -- 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
[jira] Commented: (MNG-3890) Transitive dependencies override explicitly set scope.
[ http://jira.codehaus.org/browse/MNG-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=164356#action_164356 ] Benjamin Bentmann commented on MNG-3890: Applied your fix to the IT POM, thanks Torben! > Transitive dependencies override explicitly set scope. > -- > > Key: MNG-3890 > URL: http://jira.codehaus.org/browse/MNG-3890 > Project: Maven 2 > Issue Type: Bug > Components: Dependencies >Affects Versions: 2.0.9, 2.1.0-M1, 3.0-alpha-1 >Reporter: Stephan Kleine >Priority: Critical > Fix For: 2.0.11 > > Attachments: MMG-3890-core-it-suite.patch, testcase.tar.bz2 > > > Transitive dependencies override explicitly set scope. > E.g. a project A depends on "Hibernate" with default scope and a project B > depends on project A as well as on "Hibernate" for which it sets the scope > explicitly to "provided". Further an EAR project C depends on project B (see > the attached testcase). > Now I would expect that C does not contain any jars for Hibernate and its > dependencies since B explicitly set the scope to "provided". Sadly this is > not the case and C contains all hibernate jars. The only way around this I > have found is setting the scope to "provided" for Hibernate in A as well - > which is just a crude hack that produces other issues. > IMHO this is a bug because Maven should respect the overridden dependency > scope since the current way forces me to set the scope to provided in A which > is just wrong. > Please try to get this fixed for 2.10 or 2.1 since it's a real pita atm. -- 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
[jira] Commented: (MNG-3890) Transitive dependencies override explicitly set scope.
[ http://jira.codehaus.org/browse/MNG-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=157099#action_157099 ] Benjamin Bentmann commented on MNG-3890: IT has been created from provided example with test artifacts to exhibit problem: {noformat} [INFO] [INFO] [dependency:tree] [INFO] org.apache.maven.its.mng3890:b:jar:0.1 [INFO] \- org.apache.maven.its.mng3890:a:jar:0.1:compile [INFO] [INFO] [dependency:tree] [INFO] org.apache.maven.its.mng3890:c:jar:0.1 [INFO] +- org.apache.maven.its.mng3890:a:jar:0.1:provided (scope not updated to compile) [INFO] \- org.apache.maven.its.mng3890:b:jar:0.1:compile [INFO] [INFO] [dependency:tree] [INFO] org.apache.maven.its.mng3890:test:jar:1.0 [INFO] \- org.apache.maven.its.mng3890:c:jar:0.1:compile [INFO]\- org.apache.maven.its.mng3890:b:jar:0.1:compile [INFO] \- org.apache.maven.its.mng3890:a:jar:0.1:compile << ERROR: Should be excluded because declared as provided by c [INFO] {noformat} > Transitive dependencies override explicitly set scope. > -- > > Key: MNG-3890 > URL: http://jira.codehaus.org/browse/MNG-3890 > Project: Maven 2 > Issue Type: Bug > Components: Dependencies >Affects Versions: 2.0.9, 2.1.0-M1, 3.0-alpha-1 >Reporter: Stephan Kleine >Priority: Critical > Attachments: testcase.tar.bz2 > > > Transitive dependencies override explicitly set scope. > E.g. a project A depends on "Hibernate" with default scope and a project B > depends on project A as well as on "Hibernate" for which it sets the scope > explicitly to "provided". Further an EAR project C depends on project B (see > the attached testcase). > Now I would expect that C does not contain any jars for Hibernate and its > dependencies since B explicitly set the scope to "provided". Sadly this is > not the case and C contains all hibernate jars. The only way around this I > have found is setting the scope to "provided" for Hibernate in A as well - > which is just a crude hack that produces other issues. > IMHO this is a bug because Maven should respect the overridden dependency > scope since the current way forces me to set the scope to provided in A which > is just wrong. > Please try to get this fixed for 2.10 or 2.1 since it's a real pita atm. -- 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