PR: MNG-818

allow a certain artifact type to designate it includes its dependencies already, disabling transitivity



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293535 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-04 05:25:40 +00:00
parent 22000809c3
commit d8875a4f7d
16 changed files with 131 additions and 4 deletions

View File

@ -31,4 +31,6 @@ public interface ArtifactHandler
String getClassifier();
String getPackaging();
boolean isIncludesDependencies();
}

View File

@ -17,7 +17,7 @@ package org.apache.maven.artifact.handler;
*/
/**
* @author <a href="mailto:brett@apach.org">Brett Porter</a>
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -94,6 +94,17 @@
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
<type>war</type>
<includesDependencies>true</includesDependencies>
</configuration>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>ear</role-hint>
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
<type>ear</type>
<includesDependencies>true</includesDependencies>
</configuration>
</component>

View File

@ -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

View File

@ -1,3 +1,4 @@
it0080
it0079
it0078
it0077

View File

@ -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

View File

@ -0,0 +1 @@
package

View File

@ -0,0 +1,14 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test-components</artifactId>
<version>0.1</version>
<name>Test Components</name>
<packaging>pom</packaging>
<modules>
<module>test-component-c</module>
<module>test-component-b</module>
<module>test-component-a</module>
</modules>
</project>

View File

@ -0,0 +1,14 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>test-components</artifactId>
<groupId>test</groupId>
<version>0.1</version>
</parent>
<groupId>test</groupId>
<artifactId>test-component-a</artifactId>
<version>0.1</version>
<name>Test Component A</name>
<packaging>jar</packaging>
</project>

View File

@ -0,0 +1,3 @@
public class A {
}

View File

@ -0,0 +1,22 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>test-components</artifactId>
<groupId>test</groupId>
<version>0.1</version>
</parent>
<groupId>test</groupId>
<artifactId>test-component-b</artifactId>
<version>0.1</version>
<name>Test Component B</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test-component-a</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,5 @@
public class B
extends A
{
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app >
</web-app>

View File

@ -0,0 +1,23 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>test-components</artifactId>
<groupId>test</groupId>
<version>0.1</version>
</parent>
<groupId>test</groupId>
<artifactId>test-component-c</artifactId>
<version>0.1</version>
<name>Test Component C</name>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test-component-b</artifactId>
<version>0.1</version>
<type>war</type>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,5 @@
public class C
extends A
{
}

View File

@ -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() );