mirror of https://github.com/apache/maven.git
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:
parent
22000809c3
commit
d8875a4f7d
|
@ -31,4 +31,6 @@ public interface ArtifactHandler
|
||||||
String getClassifier();
|
String getClassifier();
|
||||||
|
|
||||||
String getPackaging();
|
String getPackaging();
|
||||||
|
|
||||||
|
boolean isIncludesDependencies();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 $
|
* @version $Id: AbstractArtifactHandler.java 189871 2005-06-10 00:57:19Z brett $
|
||||||
*/
|
*/
|
||||||
public class DefaultArtifactHandler
|
public class DefaultArtifactHandler
|
||||||
|
@ -33,6 +33,8 @@ public class DefaultArtifactHandler
|
||||||
|
|
||||||
private String packaging;
|
private String packaging;
|
||||||
|
|
||||||
|
private boolean includesDependencies;
|
||||||
|
|
||||||
public DefaultArtifactHandler()
|
public DefaultArtifactHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -78,4 +80,9 @@ public class DefaultArtifactHandler
|
||||||
}
|
}
|
||||||
return packaging;
|
return packaging;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIncludesDependencies()
|
||||||
|
{
|
||||||
|
return includesDependencies;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,17 @@
|
||||||
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
|
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
|
||||||
<configuration>
|
<configuration>
|
||||||
<type>war</type>
|
<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>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
|
|
@ -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
|
it0079: Test that source attachments have the same build number as the main
|
||||||
artifact when deployed.
|
artifact when deployed.
|
||||||
|
|
||||||
|
it0080: Test that depending on a WAR doesn't also get its dependencies
|
||||||
|
transitively.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
- generated sources
|
- generated sources
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
it0080
|
||||||
it0079
|
it0079
|
||||||
it0078
|
it0078
|
||||||
it0077
|
it0077
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
package
|
|
@ -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>
|
|
@ -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>
|
|
@ -0,0 +1,3 @@
|
||||||
|
public class A {
|
||||||
|
}
|
||||||
|
|
|
@ -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>
|
|
@ -0,0 +1,5 @@
|
||||||
|
public class B
|
||||||
|
extends A
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -0,0 +1,5 @@
|
||||||
|
public class C
|
||||||
|
extends A
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -184,11 +184,15 @@ public class MavenMetadataSource
|
||||||
result = new ResolutionGroup( pomArtifact, Collections.EMPTY_SET, Collections.EMPTY_LIST );
|
result = new ResolutionGroup( pomArtifact, Collections.EMPTY_SET, Collections.EMPTY_LIST );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
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
|
// 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?)
|
// or used the inherited scope (should that be passed to the buildFromRepository method above?)
|
||||||
Set artifacts = project.createArtifacts( artifactFactory, artifact.getScope(),
|
artifacts = project.createArtifacts( artifactFactory, artifact.getScope(),
|
||||||
artifact.getDependencyFilter() );
|
artifact.getDependencyFilter() );
|
||||||
|
}
|
||||||
|
|
||||||
List repositories = aggregateRepositoryLists( remoteRepositories,
|
List repositories = aggregateRepositoryLists( remoteRepositories,
|
||||||
project.getRemoteArtifactRepositories() );
|
project.getRemoteArtifactRepositories() );
|
||||||
|
|
Loading…
Reference in New Issue