diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java index e1faaa2ba3..ee0423036d 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java @@ -31,4 +31,6 @@ public interface ArtifactHandler String getClassifier(); String getPackaging(); + + boolean isIncludesDependencies(); } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java index 3c8a51b9c2..f14058c8b5 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java @@ -17,7 +17,7 @@ package org.apache.maven.artifact.handler; */ /** - * @author Brett Porter + * @author Brett Porter * @version $Id: AbstractArtifactHandler.java 189871 2005-06-10 00:57:19Z brett $ */ public class DefaultArtifactHandler @@ -33,6 +33,8 @@ public class DefaultArtifactHandler private String packaging; + private boolean includesDependencies; + public DefaultArtifactHandler() { } @@ -78,4 +80,9 @@ public class DefaultArtifactHandler } return packaging; } + + public boolean isIncludesDependencies() + { + return includesDependencies; + } } diff --git a/maven-artifact/src/main/resources/META-INF/plexus/components.xml b/maven-artifact/src/main/resources/META-INF/plexus/components.xml index e244b2bf5b..977c4000a5 100644 --- a/maven-artifact/src/main/resources/META-INF/plexus/components.xml +++ b/maven-artifact/src/main/resources/META-INF/plexus/components.xml @@ -94,6 +94,17 @@ org.apache.maven.artifact.handler.DefaultArtifactHandler war + true + + + + + org.apache.maven.artifact.handler.ArtifactHandler + ear + org.apache.maven.artifact.handler.DefaultArtifactHandler + + ear + true diff --git a/maven-core-it/README.txt b/maven-core-it/README.txt index 509e050c38..a94690f95e 100644 --- a/maven-core-it/README.txt +++ b/maven-core-it/README.txt @@ -217,6 +217,9 @@ it0078: Test that configuration for maven-compiler-plugin is injected from it0079: Test that source attachments have the same build number as the main artifact when deployed. +it0080: Test that depending on a WAR doesn't also get its dependencies + transitively. + ------------------------------------------------------------------------------- - generated sources diff --git a/maven-core-it/integration-tests.txt b/maven-core-it/integration-tests.txt index 53562ce94e..f2a78e4ceb 100644 --- a/maven-core-it/integration-tests.txt +++ b/maven-core-it/integration-tests.txt @@ -1,3 +1,4 @@ +it0080 it0079 it0078 it0077 diff --git a/maven-core-it/it0080/expected-results.txt b/maven-core-it/it0080/expected-results.txt new file mode 100644 index 0000000000..726fedb51f --- /dev/null +++ b/maven-core-it/it0080/expected-results.txt @@ -0,0 +1,7 @@ +test-component-a/target/test-component-a-0.1.jar +test-component-b/target/test-component-b-0.1.war +test-component-b/target/test-component-b-0.1.war!/WEB-INF/lib/test-component-a-0.1.jar +test-component-c/target/test-component-c-0.1.ear +test-component-c/target/test-component-c-0.1.ear!/test-component-b-0.1.war +test-component-c/target/test-component-c-0.1/test-component-b-0.1.war +!test-component-c/target/test-component-c-0.1/test-component-a-0.1.jar diff --git a/maven-core-it/it0080/goals.txt b/maven-core-it/it0080/goals.txt new file mode 100644 index 0000000000..ba3bd78738 --- /dev/null +++ b/maven-core-it/it0080/goals.txt @@ -0,0 +1 @@ +package diff --git a/maven-core-it/it0080/pom.xml b/maven-core-it/it0080/pom.xml new file mode 100644 index 0000000000..cb0f012490 --- /dev/null +++ b/maven-core-it/it0080/pom.xml @@ -0,0 +1,14 @@ + + 4.0.0 + test + test-components + 0.1 + Test Components + pom + + + test-component-c + test-component-b + test-component-a + + diff --git a/maven-core-it/it0080/test-component-a/pom.xml b/maven-core-it/it0080/test-component-a/pom.xml new file mode 100644 index 0000000000..f235fcbedf --- /dev/null +++ b/maven-core-it/it0080/test-component-a/pom.xml @@ -0,0 +1,14 @@ + + 4.0.0 + + test-components + test + 0.1 + + + test + test-component-a + 0.1 + Test Component A + jar + diff --git a/maven-core-it/it0080/test-component-a/src/main/java/A.java b/maven-core-it/it0080/test-component-a/src/main/java/A.java new file mode 100644 index 0000000000..73e270dbea --- /dev/null +++ b/maven-core-it/it0080/test-component-a/src/main/java/A.java @@ -0,0 +1,3 @@ +public class A { +} + diff --git a/maven-core-it/it0080/test-component-b/pom.xml b/maven-core-it/it0080/test-component-b/pom.xml new file mode 100644 index 0000000000..9e85ac0cd0 --- /dev/null +++ b/maven-core-it/it0080/test-component-b/pom.xml @@ -0,0 +1,22 @@ + + 4.0.0 + + test-components + test + 0.1 + + + test + test-component-b + 0.1 + Test Component B + war + + + + test + test-component-a + 0.1 + + + diff --git a/maven-core-it/it0080/test-component-b/src/main/java/B.java b/maven-core-it/it0080/test-component-b/src/main/java/B.java new file mode 100644 index 0000000000..c288d4d8b7 --- /dev/null +++ b/maven-core-it/it0080/test-component-b/src/main/java/B.java @@ -0,0 +1,5 @@ +public class B + extends A +{ +} + diff --git a/maven-core-it/it0080/test-component-b/src/main/webapp/WEB-INF/web.xml b/maven-core-it/it0080/test-component-b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..92bb2e9825 --- /dev/null +++ b/maven-core-it/it0080/test-component-b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/maven-core-it/it0080/test-component-c/pom.xml b/maven-core-it/it0080/test-component-c/pom.xml new file mode 100644 index 0000000000..db5e0f3e6c --- /dev/null +++ b/maven-core-it/it0080/test-component-c/pom.xml @@ -0,0 +1,23 @@ + + 4.0.0 + + test-components + test + 0.1 + + + test + test-component-c + 0.1 + Test Component C + ear + + + + test + test-component-b + 0.1 + war + + + diff --git a/maven-core-it/it0080/test-component-c/src/main/java/C.java b/maven-core-it/it0080/test-component-c/src/main/java/C.java new file mode 100644 index 0000000000..f7546a58a7 --- /dev/null +++ b/maven-core-it/it0080/test-component-c/src/main/java/C.java @@ -0,0 +1,5 @@ +public class C + extends A +{ +} + diff --git a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java index 348b5deabe..33e4649a66 100644 --- a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java @@ -185,10 +185,14 @@ public class MavenMetadataSource } else { - // TODO: we could possibly use p.getDependencyArtifacts instead of this call, but they haven't been filtered - // or used the inherited scope (should that be passed to the buildFromRepository method above?) - Set artifacts = project.createArtifacts( artifactFactory, artifact.getScope(), + Set artifacts = Collections.EMPTY_SET; + if ( !artifact.getArtifactHandler().isIncludesDependencies() ) + { + // TODO: we could possibly use p.getDependencyArtifacts instead of this call, but they haven't been filtered + // or used the inherited scope (should that be passed to the buildFromRepository method above?) + artifacts = project.createArtifacts( artifactFactory, artifact.getScope(), artifact.getDependencyFilter() ); + } List repositories = aggregateRepositoryLists( remoteRepositories, project.getRemoteArtifactRepositories() );