exclude old plexus utils

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@314962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-12 16:57:07 +00:00
parent d064c1ceba
commit c525b4d9ed
3 changed files with 70 additions and 29 deletions

View File

@ -86,12 +86,12 @@
<version>1.0</version> <version>1.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
@ -107,7 +107,17 @@
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId> <artifactId>plexus-interactivity-api</artifactId>
<version>1.0-alpha-4-SNAPSHOT</version> <version>1.0-alpha-4</version>
<exclusions>
<exclusion>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
@ -127,6 +137,16 @@
<groupId>org.apache.maven.wagon</groupId> <groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId> <artifactId>wagon-ssh</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.wagon</groupId> <groupId>org.apache.maven.wagon</groupId>

View File

@ -23,7 +23,6 @@ import org.xml.sax.SAXException;
import util.AbstractReader; import util.AbstractReader;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -33,6 +32,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.io.IOException;
/** /**
* Parse a POM. * Parse a POM.
@ -108,12 +108,15 @@ public class ModelReader
private final List chain; private final List chain;
private final String inheritedScope;
public ModelReader( ArtifactDownloader downloader, boolean resolveTransitiveDependencies ) public ModelReader( ArtifactDownloader downloader, boolean resolveTransitiveDependencies )
{ {
this( downloader, resolveTransitiveDependencies, Collections.EMPTY_SET, Collections.EMPTY_LIST ); this( downloader, null, resolveTransitiveDependencies, Collections.EMPTY_SET, Collections.EMPTY_LIST );
} }
public ModelReader( ArtifactDownloader downloader, boolean resolveTransitiveDependencies, Set excluded, List chain ) public ModelReader( ArtifactDownloader downloader, String inheritedScope, boolean resolveTransitiveDependencies,
Set excluded, List chain )
{ {
this.downloader = downloader; this.downloader = downloader;
@ -121,6 +124,8 @@ public class ModelReader
this.excluded = excluded; this.excluded = excluded;
this.inheritedScope = inheritedScope;
this.chain = chain; this.chain = chain;
} }
@ -245,12 +250,12 @@ public class ModelReader
} }
// actually, these should be transtive (see MNG-77) - but some projects have circular deps that way // actually, these should be transtive (see MNG-77) - but some projects have circular deps that way
ModelReader p = retrievePom( parentGroupId, parentArtifactId, parentVersion, "pom", false, excluded, ModelReader p = retrievePom( parentGroupId, parentArtifactId, parentVersion, "pom", inheritedScope, false,
Collections.EMPTY_LIST ); excluded, Collections.EMPTY_LIST );
addDependencies( p.getDependencies(), parentDependencies, null, excluded ); addDependencies( p.getDependencies(), parentDependencies, inheritedScope, excluded );
addDependencies( p.getManagedDependencies(), managedDependencies, null, Collections.EMPTY_SET ); addDependencies( p.getManagedDependencies(), managedDependencies, inheritedScope, Collections.EMPTY_SET );
resources.addAll( p.getResources() ); resources.addAll( p.getResources() );
@ -440,28 +445,33 @@ public class ModelReader
if ( !excluded.contains( dependency.getConflictId() ) ) if ( !excluded.contains( dependency.getConflictId() ) )
{ {
if ( dependency.getVersion() == null ) if ( !dependency.getScope().equals( Dependency.SCOPE_TEST ) || inheritedScope == null )
{ {
Dependency managedDependency = (Dependency) managedDependencies.get( dependency.getConflictId() ); if ( dependency.getVersion() == null )
if ( managedDependency == null )
{ {
throw new NullPointerException( "[" + groupId + ":" + artifactId + ":" + packaging + ":" + Dependency managedDependency =
version + "] " + "Dependency " + dependency.getConflictId() + (Dependency) managedDependencies.get( dependency.getConflictId() );
" is missing a version, and nothing is found in dependencyManagement. " ); if ( managedDependency == null )
{
throw new NullPointerException( "[" + groupId + ":" + artifactId + ":" + packaging + ":" +
version + "] " + "Dependency " + dependency.getConflictId() +
" is missing a version, and nothing is found in dependencyManagement. " );
}
dependency.setVersion( managedDependency.getVersion() );
} }
dependency.setVersion( managedDependency.getVersion() );
}
if ( resolveTransitiveDependencies ) if ( resolveTransitiveDependencies )
{ {
Set excluded = new HashSet( this.excluded ); Set excluded = new HashSet( this.excluded );
excluded.addAll( dependency.getExclusions() ); excluded.addAll( dependency.getExclusions() );
ModelReader p = retrievePom( dependency.getGroupId(), dependency.getArtifactId(), ModelReader p = retrievePom( dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersion(), dependency.getType(), dependency.getVersion(), dependency.getType(),
resolveTransitiveDependencies, excluded, dependency.getChain() ); dependency.getScope(), resolveTransitiveDependencies, excluded,
dependency.getChain() );
addDependencies( p.getDependencies(), transitiveDependencies, dependency.getScope(), excluded ); addDependencies( p.getDependencies(), transitiveDependencies, dependency.getScope(), excluded );
}
} }
} }
} }
@ -515,7 +525,8 @@ public class ModelReader
} }
private ModelReader retrievePom( String groupId, String artifactId, String version, String type, private ModelReader retrievePom( String groupId, String artifactId, String version, String type,
boolean resolveTransitiveDependencies, Set excluded, List chain ) String inheritedScope, boolean resolveTransitiveDependencies, Set excluded,
List chain )
throws SAXException throws SAXException
{ {
String key = groupId + ":" + artifactId + ":" + version; String key = groupId + ":" + artifactId + ":" + version;
@ -527,7 +538,7 @@ public class ModelReader
inProgress.add( key ); inProgress.add( key );
ModelReader p = new ModelReader( downloader, resolveTransitiveDependencies, excluded, chain ); ModelReader p = new ModelReader( downloader, inheritedScope, resolveTransitiveDependencies, excluded, chain );
try try
{ {

View File

@ -30,7 +30,17 @@
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId> <artifactId>plexus-interactivity-api</artifactId>
<version>1.0-alpha-4-SNAPSHOT</version> <version>1.0-alpha-4</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
<exclusion>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>