[
https://issues.jboss.org/browse/SHRINKRES-250?page=com.atlassian.jira.plu...
]
Matous Jobanek commented on SHRINKRES-250:
------------------------------------------
Hi,
first of all, I'd like to apologize for the delay of our answer.
The behavior you described above is caused by Aether. Aether is a library for working with
artifact repositories. This library is used by Resolver and it basically does the same
things as Maven itself.
It is same in this case as well - Maven doesn't resolve transitive dependencies of a
war declared as dependency of a project. There is also a issue related to this use-case:
https://issues.apache.org/jira/browse/MNG-1991
If you tried to get a dependency tree of a project that contains your dependency:
{code:xml}
<dependency>
<groupId>io.fabric8.jube</groupId>
<artifactId>war</artifactId>
<version>2.2.0</version>
<type>war</type>
</dependency>
{code}
then the tree that you get would look like this:
{noformat}
[INFO] my.reproducer:SHRINKRES-250:jar:1.0-SNAPSHOT
[INFO] \- io.fabric8.jube:war:war:2.2.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{noformat}
As you can see, there is no discrepancy in behavior of Maven and Resolver.
But if you changed the type to {{pom}}, then all transitive dependencies would be
resolved. Same it is in case of Resolver - if you used this:
{code:java}
Maven.resolver().resolve("io.fabric8.jube:war:pom:2.2.0").withTransitivity().asResolvedArtifact();
{code}
then all transitive deps would be resolved.
Resolve (transitive) dependencies for WAR artifacts
---------------------------------------------------
Key: SHRINKRES-250
URL:
https://issues.jboss.org/browse/SHRINKRES-250
Project: ShrinkWrap Resolvers
Issue Type: Feature Request
Affects Versions: 2.2.2
Reporter: Willem Salembier
Attachments: ShrinkWrapTest.java
Is there a way to resolve the (transitive) dependencies of a WAR artifacts, using the
default resolve method? The behavior seems different in comparison to JAR artifacts. Is
this intentional?
It does work if you start a resolver from a pom file.
{code}
System.out.println("JAR dependencies via resolve");
MavenResolvedArtifact[] artifacts =
Maven.resolver().resolve("io.fabric8:fabric8-cxf:jar:2.2.0").withTransitivity().asResolvedArtifact();
for (MavenResolvedArtifact artifact : artifacts) {
System.out.println(artifact);
}
System.out.println("No WAR dependencies via resolve");
artifacts =
Maven.resolver().resolve("io.fabric8.jube:war:war:2.2.0").withTransitivity().asResolvedArtifact();
for (MavenResolvedArtifact artifact : artifacts) {
System.out.println(artifact);
}
System.out.println("All WAR dependencies via pom file");
artifacts =
Maven.resolver().loadPomFromFile(artifacts[0].asFile().getAbsolutePath().replace(".war",
".pom")).importRuntimeDependencies().resolve().withTransitivity().asResolvedArtifact();
for (MavenResolvedArtifact artifact : artifacts) {
System.out.println(artifact);
}
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)