maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Osipov (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (MRESOLVER-21) Maven Resolver trying to resolve optional dependencies
Date Wed, 26 Dec 2018 12:45:00 GMT

     [ https://issues.apache.org/jira/browse/MRESOLVER-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael Osipov closed MRESOLVER-21.
-----------------------------------
       Resolution: Incomplete
    Fix Version/s:     (was: waiting-for-feedback)

No reaction of a fix proposal.

> Maven Resolver trying to resolve optional dependencies
> ------------------------------------------------------
>
>                 Key: MRESOLVER-21
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-21
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: resolver
>            Reporter: Cedric Beust
>            Priority: Major
>
> I modified the `ResolveTransitiveDependencies.java` example in two ways:
> - Modified the id to `"org.springframework:spring-context-support:2.5.6.SEC03"`
> - Replaced the filter with one that excludes optional dependencies
> I'm including the full code below.
> Despite that, `system.resolveDependencies()` fails with a `DependencyResolutionException
when trying to resolve a bunch of optional dependencies, sugh as `jasperreports`.
> Head of the stack trace:
> {noformat}org.eclipse.aether.resolution.DependencyResolutionException: Failed to collect
dependencies at org.springframework:spring-context-support:jar:2.5.6.SEC03 -> jasperreports:jasperreports:jar:2.0.5
-> commons-logging:commons-logging:jar:99.0-does-not-exist
> 	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:380)
> 	at org.apache.maven.resolver.examples.ResolveTransitiveDependencies.main(ResolveTransitiveDependencies.java:71)
> Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect
dependencies at org.springframework:spring-context-support:jar:2.5.6.SEC03 -> jasperreports:jasperreports:jar:2.0.5
-> commons-logging:commons-logging:jar:99.0-does-not-exist
> 	at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:291)
> 	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
> 	... 1 more
> Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read
artifact descriptor for commons-logging:commons-logging:jar:99.0-does-not-exist{noformat}
> {code:java}
>     public static void main( String[] args )
>         throws Exception
>     {
>         System.out.println( "------------------------------------------------------------"
);
>         System.out.println( ResolveTransitiveDependencies.class.getSimpleName() );
>         RepositorySystem system = Booter.newRepositorySystem();
>         RepositorySystemSession session = Booter.newRepositorySystemSession( system );
>         Artifact artifact = new DefaultArtifact( "org.springframework:spring-context-support:2.5.6.SEC03"
);
>         DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter( JavaScopes.COMPILE
);
>         DependencyFilter optionalFilter = new DependencyFilter() {
>             @Override
>             public boolean accept(DependencyNode dependencyNode, List<DependencyNode>
list) {
>                 return ! dependencyNode.getDependency().getOptional();
>             }
>         };
>         CollectRequest collectRequest = new CollectRequest();
>         collectRequest.setRoot( new Dependency( artifact, JavaScopes.COMPILE ) );
>         collectRequest.setRepositories( Booter.newRepositories( system, session ) );
>         DependencyRequest dependencyRequest = new DependencyRequest( collectRequest,
optionalFilter );
>         try {
>             List<ArtifactResult> artifactResults =
>                     system.resolveDependencies(session, dependencyRequest).getArtifactResults();
>             for (ArtifactResult artifactResult : artifactResults) {
>                 System.out.println(artifactResult.getArtifact() + " resolved to "
>                         + artifactResult.getArtifact().getFile());
>             }
>         } catch(Exception ex) {
>             ex.printStackTrace();
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message