mirror of https://github.com/apache/maven.git
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:
parent
c4782c4a38
commit
cfbcba22a8
|
@ -55,6 +55,8 @@ public interface Artifact
|
||||||
|
|
||||||
String SCOPE_RUNTIME = ArtifactScopeEnum.runtime.toString();
|
String SCOPE_RUNTIME = ArtifactScopeEnum.runtime.toString();
|
||||||
|
|
||||||
|
String SCOPE_RUNTIME_PLUS_SYSTEM = ArtifactScopeEnum.runtime_plus_system.toString();
|
||||||
|
|
||||||
String SCOPE_PROVIDED = ArtifactScopeEnum.provided.toString();
|
String SCOPE_PROVIDED = ArtifactScopeEnum.provided.toString();
|
||||||
|
|
||||||
String SCOPE_SYSTEM = ArtifactScopeEnum.system.toString();
|
String SCOPE_SYSTEM = ArtifactScopeEnum.system.toString();
|
||||||
|
|
|
@ -10,7 +10,7 @@ package org.apache.maven.artifact;
|
||||||
|
|
||||||
public enum ArtifactScopeEnum
|
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;
|
public static final ArtifactScopeEnum DEFAULT_SCOPE = compile;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public enum ArtifactScopeEnum
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getId()
|
int getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
|
@ -62,10 +62,14 @@ public enum ArtifactScopeEnum
|
||||||
{
|
{
|
||||||
return Artifact.SCOPE_PROVIDED;
|
return Artifact.SCOPE_PROVIDED;
|
||||||
}
|
}
|
||||||
else
|
else if ( id == 5 )
|
||||||
{
|
{
|
||||||
return Artifact.SCOPE_SYSTEM;
|
return Artifact.SCOPE_SYSTEM;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ArtifactScopeEnum [][][] _compliancySets = {
|
private static final ArtifactScopeEnum [][][] _compliancySets = {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ScopeArtifactFilter
|
||||||
private final boolean providedScope;
|
private final boolean providedScope;
|
||||||
|
|
||||||
private final boolean systemScope;
|
private final boolean systemScope;
|
||||||
|
|
||||||
public ScopeArtifactFilter( String scope )
|
public ScopeArtifactFilter( String scope )
|
||||||
{
|
{
|
||||||
if ( Artifact.SCOPE_COMPILE.equals( scope ) )
|
if ( Artifact.SCOPE_COMPILE.equals( scope ) )
|
||||||
|
@ -58,6 +58,14 @@ public class ScopeArtifactFilter
|
||||||
runtimeScope = true;
|
runtimeScope = true;
|
||||||
testScope = false;
|
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 ) )
|
else if ( Artifact.SCOPE_TEST.equals( scope ) )
|
||||||
{
|
{
|
||||||
systemScope = true;
|
systemScope = true;
|
||||||
|
|
|
@ -377,9 +377,15 @@ public class DefaultPluginManager
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws InvalidPluginException, ArtifactNotFoundException, ArtifactResolutionException
|
throws InvalidPluginException, ArtifactNotFoundException, ArtifactResolutionException
|
||||||
{
|
{
|
||||||
|
ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM );
|
||||||
|
|
||||||
Set<Artifact> projectPluginDependencies;
|
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
|
try
|
||||||
{
|
{
|
||||||
projectPluginDependencies = MavenMetadataSource.createArtifacts(
|
projectPluginDependencies = MavenMetadataSource.createArtifacts(
|
||||||
|
@ -387,7 +393,7 @@ public class DefaultPluginManager
|
||||||
plugin.getDependencies(),
|
plugin.getDependencies(),
|
||||||
null,
|
null,
|
||||||
coreArtifactFilterManager.getCoreArtifactFilter(),
|
coreArtifactFilterManager.getCoreArtifactFilter(),
|
||||||
project );
|
project );
|
||||||
}
|
}
|
||||||
catch ( InvalidDependencyVersionException e )
|
catch ( InvalidDependencyVersionException e )
|
||||||
{
|
{
|
||||||
|
@ -399,10 +405,7 @@ public class DefaultPluginManager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resolutionGroup = artifactMetadataSource.retrieve(
|
resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository, project.getRemoteArtifactRepositories() );
|
||||||
pluginArtifact,
|
|
||||||
localRepository,
|
|
||||||
project.getRemoteArtifactRepositories() );
|
|
||||||
}
|
}
|
||||||
catch ( ArtifactMetadataRetrievalException e )
|
catch ( ArtifactMetadataRetrievalException e )
|
||||||
{
|
{
|
||||||
|
@ -418,8 +421,8 @@ public class DefaultPluginManager
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MavenProject pluginProject =
|
MavenProject pluginProject =
|
||||||
mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(),
|
mavenProjectBuilder.buildFromRepository( pluginArtifact, project.getRemoteArtifactRepositories(), localRepository );
|
||||||
localRepository );
|
|
||||||
if ( pluginProject != null )
|
if ( pluginProject != null )
|
||||||
{
|
{
|
||||||
pluginManagedDependencies = pluginProject.getManagedVersionMap();
|
pluginManagedDependencies = pluginProject.getManagedVersionMap();
|
||||||
|
@ -430,8 +433,6 @@ public class DefaultPluginManager
|
||||||
// this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
|
// this can't happen, it would have blowed up at artifactMetadataSource.retrieve()
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkPlexusUtils( resolutionGroup, artifactFactory );
|
|
||||||
|
|
||||||
Set<Artifact> dependencies = new LinkedHashSet<Artifact>();
|
Set<Artifact> dependencies = new LinkedHashSet<Artifact>();
|
||||||
|
|
||||||
// resolve the plugin dependencies specified in <plugin><dependencies> first:
|
// resolve the plugin dependencies specified in <plugin><dependencies> first:
|
||||||
|
@ -446,8 +447,6 @@ public class DefaultPluginManager
|
||||||
|
|
||||||
repositories.addAll( project.getRemoteArtifactRepositories() );
|
repositories.addAll( project.getRemoteArtifactRepositories() );
|
||||||
|
|
||||||
ArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
|
|
||||||
|
|
||||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively(
|
ArtifactResolutionResult result = artifactResolver.resolveTransitively(
|
||||||
dependencies,
|
dependencies,
|
||||||
pluginArtifact,
|
pluginArtifact,
|
||||||
|
@ -455,8 +454,7 @@ public class DefaultPluginManager
|
||||||
localRepository,
|
localRepository,
|
||||||
repositories.isEmpty()
|
repositories.isEmpty()
|
||||||
? Collections.EMPTY_LIST
|
? Collections.EMPTY_LIST
|
||||||
: new ArrayList(
|
: new ArrayList( repositories ),
|
||||||
repositories ),
|
|
||||||
artifactMetadataSource,
|
artifactMetadataSource,
|
||||||
filter );
|
filter );
|
||||||
|
|
||||||
|
|
|
@ -457,8 +457,10 @@ public class MavenMetadataSource
|
||||||
* @return {@link Set} < {@link Artifact} >
|
* @return {@link Set} < {@link Artifact} >
|
||||||
* @todo desperately needs refactoring. It's just here because it's implementation is maven-project specific
|
* @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,
|
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory,
|
||||||
String inheritedScope, ArtifactFilter dependencyFilter,
|
List<Dependency> dependencies,
|
||||||
|
String inheritedScope,
|
||||||
|
ArtifactFilter dependencyFilter,
|
||||||
MavenProject project )
|
MavenProject project )
|
||||||
throws InvalidDependencyVersionException
|
throws InvalidDependencyVersionException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue