jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-3067

Getting arbitrary depth=2 dependencies when using optional=true

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.6
  • Fix Version/s: Issues to be reviewed for 3.x
  • Component/s: Dependencies
  • Labels:
    None

Description

When using a dependency section like this in a WAR (just an excerpt - these are not the culprit to my knowledge):
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean_xpath</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<optional>true</optional>
</dependency>

I am getting artifacts with a depth of 2 - when nothing should resolve. Only depth 1 (non-optional deps, plus their deps, etc) should be resolving. i.e.

[INFO] mq: 2
[INFO] mqjms: 2
[INFO] spring-orm: 2
[INFO] struts: 1
[INFO] child: commons-beanutils:commons-beanutils:jar:1.6.1:compile (2; disabled)
[INFO] child: commons-collections:commons-collections:jar:3.1:compile (2; disabled)
[INFO] child: struts:struts-legacy:jar:1.1:compile (2; enabled)
[INFO] child: commons-digester:commons-digester:jar:1.6:compile (2; disabled)
[INFO] child: commons-fileupload:commons-fileupload:jar:1.0:compile (2; enabled)
[INFO] child: commons-lang:commons-lang:jar:2.1:compile (2; disabled)
[INFO] child: commons-logging:commons-logging:jar:1.0:compile (2; disabled)
[INFO] child: commons-validator:commons-validator:jar:1.1.4:compile (2; disabled)
[INFO] child: oro:oro:jar:2.0.7:compile (2; disabled)
[INFO] child: javax.sql:jdbc-stdext:jar:2.0:compile (2; enabled)
[INFO] commons-logging: 1
[INFO] child: log4j:log4j:jar:1.2.6:compile (2; enabled)
[INFO] child: logkit:logkit:jar:1.0.1:compile (2; enabled)
[INFO] child: avalon-framework:avalon-framework:jar:4.1.3:compile (2; enabled)
[INFO] distribution-service-client-jar: 2
[INFO] jdbc-stdext: 2
[INFO] struts-bean: 1
[INFO] cmf-nol-submit-jar: 2
[INFO] mqiiop: 2
[INFO] distribution-service-ejb: 2
[INFO] jaxen: 2
[INFO] spring-dao: 2
[INFO] struts-tiles: 1
[INFO] cmf-final-jar: 2
[INFO] struts-legacy: 2
[INFO] standard: 1
[INFO] saxpath: 2
[INFO] jstl: 1
[INFO] nw-exception: 1
[INFO] relaxngDatatype: 2
[INFO] mqbind: 2
[INFO] struts-logic: 1
[INFO] commons-fileupload: 2
[INFO] isorelax: 2
[INFO] spring-core: 2
[INFO] log4j: 1
[INFO] msv: 2
[INFO] struts-nested: 1
[INFO] nw-struts: 1
[INFO] child: struts:struts:jar:1.1:compile (2; disabled)
[INFO] struts-html: 1
[INFO] authorization-tag-jar: 1
[INFO] child: commons-logging:commons-logging:jar:1.0.4:compile (2; disabled)
[INFO] child: log4j:log4j:jar:1.2.7:compile (2; disabled)
[INFO] child: com.nationwide.common:nw-exception:jar:1.2.0:compile (2; disabled)
[INFO] child: com.nationwide.pc.claims.horizon:simple-security-client-jar:jar:2.0.0:compile (2; disabled)

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jason Melnick added a comment - 22/Jun/07 10:08 AM

Note that the output towards the end was generated by using the following code:

ArtifactFilter filter = new ScopeArtifactFilter(DefaultArtifact.SCOPE_RUNTIME);
result = resolver.resolveTransitively(dependencyArtifacts, mavenProject.getArtifact(),local,remoteRepos, source, filter);

Set nodes = result.getArtifactResolutionNodes();
for (Iterator iter = nodes.iterator(); iter.hasNext() {
ResolutionNode node = (ResolutionNode) iter.next();

if (!node.getArtifact().isOptional()) {
logger.info(node.getArtifact().getArtifactId() + ": " + node.getDepth());
if (node.getDepth() == 1) {
for (Iterator iter2 = node.getChildrenIterator(); iter2.hasNext() { logger.info("\t child: " + iter2.next().toString()); }
}
}
}

Also, none of the non-child depth 2 dependencies are declared in this POM and are transitive dependencies of declared deps marked as optional.

Show
Jason Melnick added a comment - 22/Jun/07 10:08 AM Note that the output towards the end was generated by using the following code: ArtifactFilter filter = new ScopeArtifactFilter(DefaultArtifact.SCOPE_RUNTIME); result = resolver.resolveTransitively(dependencyArtifacts, mavenProject.getArtifact(),local,remoteRepos, source, filter); Set nodes = result.getArtifactResolutionNodes(); for (Iterator iter = nodes.iterator(); iter.hasNext() { ResolutionNode node = (ResolutionNode) iter.next(); if (!node.getArtifact().isOptional()) { logger.info(node.getArtifact().getArtifactId() + ": " + node.getDepth()); if (node.getDepth() == 1) { for (Iterator iter2 = node.getChildrenIterator(); iter2.hasNext() { logger.info("\t child: " + iter2.next().toString()); } } } } Also, none of the non-child depth 2 dependencies are declared in this POM and are transitive dependencies of declared deps marked as optional.
Hide
Permalink
Barend Garvelink added a comment - 04/Apr/08 1:31 AM

Is this related to MNG-3269 ?

Show
Barend Garvelink added a comment - 04/Apr/08 1:31 AM Is this related to MNG-3269 ?

People

  • Assignee:
    Unassigned
    Reporter:
    Jason Melnick
Vote (2)
Watch (5)

Dates

  • Created:
    22/Jun/07 9:57 AM
    Updated:
    13/Dec/08 6:35 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.