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:
Brett Leslie Porter 2005-06-07 15:51:25 +00:00
parent d6d65fc75a
commit 8772f0f23e
3 changed files with 13 additions and 95 deletions

View File

@ -13,7 +13,9 @@
<artifact:pom file="pom.xml" id="maven.project"/>
<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"/>
<localRepository refid="local.repository"/>
</artifact:dependencies>

View File

@ -26,13 +26,14 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.project.MavenProjectBuilder;
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.types.FileList;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -67,7 +68,12 @@ public class DependenciesTask
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(); )
{
Dependency dependency = (Dependency) i.next();
@ -76,10 +82,7 @@ public class DependenciesTask
null );
artifacts.add( a );
}
ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
MavenMetadataSource metadataSource = new MavenMetadataSource( resolver, (MavenProjectBuilder) lookup(
MavenProjectBuilder.ROLE ) );
*/
log( "Resolving dependencies..." );

View File

@ -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 + "]";
}
}