mirror of https://github.com/apache/maven.git
PR: MNG-407
allow filtering of transitive dependencies git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@188803 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d6d65fc75a
commit
8772f0f23e
|
@ -13,7 +13,9 @@
|
||||||
<artifact:pom file="pom.xml" id="maven.project"/>
|
<artifact:pom file="pom.xml" id="maven.project"/>
|
||||||
|
|
||||||
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
|
||||||
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
|
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2">
|
||||||
|
<exclusion groupId="junit" artifactId="junit" />
|
||||||
|
</dependency>
|
||||||
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
||||||
<localRepository refid="local.repository"/>
|
<localRepository refid="local.repository"/>
|
||||||
</artifact:dependencies>
|
</artifact:dependencies>
|
||||||
|
|
|
@ -26,13 +26,14 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||||
import org.apache.maven.project.MavenProjectBuilder;
|
import org.apache.maven.project.MavenProjectBuilder;
|
||||||
import org.apache.maven.project.artifact.MavenMetadataSource;
|
import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||||
|
import org.apache.maven.model.Exclusion;
|
||||||
|
import org.apache.maven.model.Dependency;
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.types.FileList;
|
import org.apache.tools.ant.types.FileList;
|
||||||
import org.apache.tools.ant.types.Path;
|
|
||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
|
import org.apache.tools.ant.types.Path;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -67,7 +68,12 @@ public class DependenciesTask
|
||||||
|
|
||||||
ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||||
|
|
||||||
Set artifacts = new HashSet();
|
ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
|
||||||
|
MavenMetadataSource metadataSource = new MavenMetadataSource( resolver, (MavenProjectBuilder) lookup(
|
||||||
|
MavenProjectBuilder.ROLE ) );
|
||||||
|
|
||||||
|
Set artifacts = metadataSource.createArtifacts( dependencies, null, null );
|
||||||
|
/*
|
||||||
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Dependency dependency = (Dependency) i.next();
|
Dependency dependency = (Dependency) i.next();
|
||||||
|
@ -76,10 +82,7 @@ public class DependenciesTask
|
||||||
null );
|
null );
|
||||||
artifacts.add( a );
|
artifacts.add( a );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
|
|
||||||
MavenMetadataSource metadataSource = new MavenMetadataSource( resolver, (MavenProjectBuilder) lookup(
|
|
||||||
MavenProjectBuilder.ROLE ) );
|
|
||||||
|
|
||||||
log( "Resolving dependencies..." );
|
log( "Resolving dependencies..." );
|
||||||
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
package org.apache.maven.artifact.ant;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2005 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: describe
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class Dependency
|
|
||||||
{
|
|
||||||
private String groupId;
|
|
||||||
private String artifactId;
|
|
||||||
private String version;
|
|
||||||
private String scope = "compile";
|
|
||||||
private String type = "jar";
|
|
||||||
|
|
||||||
public String getGroupId()
|
|
||||||
{
|
|
||||||
return groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroupId( String groupId )
|
|
||||||
{
|
|
||||||
this.groupId = groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArtifactId()
|
|
||||||
{
|
|
||||||
return artifactId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArtifactId( String artifactId )
|
|
||||||
{
|
|
||||||
this.artifactId = artifactId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVersion( String version )
|
|
||||||
{
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScope()
|
|
||||||
{
|
|
||||||
return scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScope( String scope )
|
|
||||||
{
|
|
||||||
this.scope = scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType( String type )
|
|
||||||
{
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return groupId + ":" + artifactId + ":" + version + ":" + type + " [scope = " + scope + "]";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue