MNG-3586: system scope is working again, the IT does not appear to work on OS/X. Both 2.0.9 and this snapshot fail the first test of the IT. Brian helped me verify and on Windows with 2.0.9 and this snapshot both tests pass.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@732929 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-01-09 05:34:14 +00:00
parent c4782c4a38
commit cfbcba22a8
5 changed files with 33 additions and 19 deletions

View File

@ -55,6 +55,8 @@ public interface Artifact
String SCOPE_RUNTIME = ArtifactScopeEnum.runtime.toString();
String SCOPE_RUNTIME_PLUS_SYSTEM = ArtifactScopeEnum.runtime_plus_system.toString();
String SCOPE_PROVIDED = ArtifactScopeEnum.provided.toString();
String SCOPE_SYSTEM = ArtifactScopeEnum.system.toString();

View File

@ -10,7 +10,7 @@ package org.apache.maven.artifact;
public enum ArtifactScopeEnum
{
compile( 1 ), test( 2 ), runtime( 3 ), provided( 4 ), system( 5 );
compile( 1 ), test( 2 ), runtime( 3 ), provided( 4 ), system( 5 ), runtime_plus_system( 6 );
public static final ArtifactScopeEnum DEFAULT_SCOPE = compile;
@ -21,7 +21,7 @@ public enum ArtifactScopeEnum
{
this.id = id;
}
int getId()
{
return id;
@ -62,10 +62,14 @@ public enum ArtifactScopeEnum
{
return Artifact.SCOPE_PROVIDED;
}
else
else if ( id == 5 )
{
return Artifact.SCOPE_SYSTEM;
}
else
{
return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM;
}
}
private static final ArtifactScopeEnum [][][] _compliancySets = {

View File

@ -39,7 +39,7 @@ public class ScopeArtifactFilter
private final boolean providedScope;
private final boolean systemScope;
public ScopeArtifactFilter( String scope )
{
if ( Artifact.SCOPE_COMPILE.equals( scope ) )
@ -58,6 +58,14 @@ public class ScopeArtifactFilter
runtimeScope = true;
testScope = false;
}
else if ( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals( scope ) )
{
systemScope = true;
providedScope = false;
compileScope = true;
runtimeScope = true;
testScope = false;
}
else if ( Artifact.SCOPE_TEST.equals( scope ) )
{
systemScope = true;

View File

@ -377,9 +377,15 @@ public class DefaultPluginManager
ArtifactRepository localRepository )
throws InvalidPluginException, ArtifactNotFoundException, ArtifactResolutionException
{
ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM );
Set<Artifact> projectPluginDependencies;
// The case where we have a plugin that can host multiple versions of a particular tool. Say the
// Antlr plugin which has many versions and you may want the plugin to execute with version 2.7.1 of
// Antlr versus 2.7.2. In this case the project itself would specify dependencies within the plugin
// element.
try
{
projectPluginDependencies = MavenMetadataSource.createArtifacts(
@ -387,7 +393,7 @@ public class DefaultPluginManager
plugin.getDependencies(),
null,
coreArtifactFilterManager.getCoreArtifactFilter(),
project );
project );
}
catch ( InvalidDependencyVersionException e )
{
@ -399,10 +405,7 @@ public class DefaultPluginManager
try
{
resolutionGroup = artifactMetadataSource.retrieve(
pluginArtifact,
localRepository,
project.getRemoteArtifactRepositories() );
resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository, project.getRemoteArtifactRepositories() );
}
catch ( ArtifactMetadataRetrievalException e )
{
@ -418,8 +421,8 @@ public class DefaultPluginManager
try
{
MavenProject pluginProject =
mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(),
localRepository );
mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(), localRepository );
if ( pluginProject != null )
{
pluginManagedDependencies = pluginProject.getManagedVersionMap();
@ -430,8 +433,6 @@ public class DefaultPluginManager
// this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
}
// checkPlexusUtils( resolutionGroup, artifactFactory );
Set<Artifact> dependencies = new LinkedHashSet<Artifact>();
// resolve the plugin dependencies specified in <plugin><dependencies> first:
@ -446,8 +447,6 @@ public class DefaultPluginManager
repositories.addAll( project.getRemoteArtifactRepositories() );
ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
ArtifactResolutionResult result = artifactResolver.resolveTransitively(
dependencies,
pluginArtifact,
@ -455,8 +454,7 @@ public class DefaultPluginManager
localRepository,
repositories.isEmpty()
? Collections.EMPTY_LIST
: new ArrayList(
repositories ),
: new ArrayList( repositories ),
artifactMetadataSource,
filter );

View File

@ -457,8 +457,10 @@ public class MavenMetadataSource
* @return {@link Set} &lt; {@link Artifact} >
* @todo desperately needs refactoring. It's just here because it's implementation is maven-project specific
*/
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies,
String inheritedScope, ArtifactFilter dependencyFilter,
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory,
List<Dependency> dependencies,
String inheritedScope,
ArtifactFilter dependencyFilter,
MavenProject project )
throws InvalidDependencyVersionException
{