mirror of https://github.com/apache/maven.git
o Accounted for refactoring of aether-api
This commit is contained in:
parent
25a273f744
commit
02927ead50
|
@ -69,6 +69,8 @@ import org.eclipse.aether.impl.RepositoryEventDispatcher;
|
|||
import org.eclipse.aether.impl.VersionResolver;
|
||||
import org.eclipse.aether.repository.WorkspaceRepository;
|
||||
import org.eclipse.aether.resolution.ArtifactDescriptorException;
|
||||
import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
|
||||
import org.eclipse.aether.resolution.ArtifactDescriptorPolicyRequest;
|
||||
import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
|
||||
import org.eclipse.aether.resolution.ArtifactDescriptorResult;
|
||||
import org.eclipse.aether.resolution.ArtifactRequest;
|
||||
|
@ -293,7 +295,7 @@ public class DefaultArtifactDescriptorReader
|
|||
RepositoryException exception =
|
||||
new RepositoryException( "Artifact relocations form a cycle: " + visited );
|
||||
invalidDescriptor( session, trace, artifact, exception );
|
||||
if ( session.isIgnoreInvalidArtifactDescriptor() )
|
||||
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -318,7 +320,7 @@ public class DefaultArtifactDescriptorReader
|
|||
if ( e.getCause() instanceof ArtifactNotFoundException )
|
||||
{
|
||||
missingDescriptor( session, trace, artifact, (Exception) e.getCause() );
|
||||
if ( session.isIgnoreMissingArtifactDescriptor() )
|
||||
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -363,7 +365,7 @@ public class DefaultArtifactDescriptorReader
|
|||
}
|
||||
}
|
||||
invalidDescriptor( session, trace, artifact, e );
|
||||
if ( session.isIgnoreInvalidArtifactDescriptor() )
|
||||
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -488,4 +490,14 @@ public class DefaultArtifactDescriptorReader
|
|||
repositoryEventDispatcher.dispatch( event.build() );
|
||||
}
|
||||
|
||||
private int getPolicy( RepositorySystemSession session, Artifact artifact, ArtifactDescriptorRequest request )
|
||||
{
|
||||
ArtifactDescriptorPolicy policy = session.getArtifactDescriptorPolicy();
|
||||
if ( policy == null )
|
||||
{
|
||||
return ArtifactDescriptorPolicy.STRICT;
|
||||
}
|
||||
return policy.getPolicy( session, new ArtifactDescriptorPolicyRequest( artifact, request.getRequestContext() ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
|
|||
import org.eclipse.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
|
||||
import org.eclipse.aether.util.graph.transformer.NearestVersionConflictResolver;
|
||||
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
|
||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||
|
||||
/**
|
||||
* A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
|
||||
|
@ -121,8 +122,7 @@ public final class MavenRepositorySystemUtils
|
|||
stereotypes.add( new DefaultArtifactType( "par", "par", "", "java", false, true ) );
|
||||
session.setArtifactTypeRegistry( stereotypes );
|
||||
|
||||
session.setIgnoreInvalidArtifactDescriptor( true );
|
||||
session.setIgnoreMissingArtifactDescriptor( true );
|
||||
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
|
||||
|
||||
Properties sysProps = System.getProperties();
|
||||
session.setSystemProps( sysProps );
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.eclipse.aether.util.graph.transformer.ConflictMarker;
|
|||
import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
|
||||
import org.eclipse.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
|
||||
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
|
||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
|
@ -339,8 +340,7 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
throws Exception
|
||||
{
|
||||
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
|
||||
session.setIgnoreMissingArtifactDescriptor( true );
|
||||
session.setIgnoreInvalidArtifactDescriptor( true );
|
||||
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
|
||||
DependencyTraverser depTraverser = new FatArtifactTraverser();
|
||||
session.setDependencyTraverser( depTraverser );
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ import org.eclipse.aether.util.repository.ChainedWorkspaceReader;
|
|||
import org.eclipse.aether.util.repository.DefaultAuthenticationSelector;
|
||||
import org.eclipse.aether.util.repository.DefaultMirrorSelector;
|
||||
import org.eclipse.aether.util.repository.DefaultProxySelector;
|
||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||
import org.eclipse.aether.util.repository.SimpleResolutionErrorPolicy;
|
||||
|
||||
/**
|
||||
|
@ -339,7 +340,7 @@ public class DefaultMaven
|
|||
|
||||
session.setCache( request.getRepositoryCache() );
|
||||
|
||||
session.setIgnoreInvalidArtifactDescriptor( true ).setIgnoreMissingArtifactDescriptor( true );
|
||||
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
|
||||
|
||||
Map<Object, Object> configProps = new LinkedHashMap<Object, Object>();
|
||||
configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
|
||||
|
|
|
@ -58,6 +58,7 @@ import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
|
|||
import org.eclipse.aether.util.filter.ScopeDependencyFilter;
|
||||
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
|
||||
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
|
||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||
|
||||
/**
|
||||
* Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility class that
|
||||
|
@ -98,8 +99,8 @@ public class DefaultPluginDependenciesResolver
|
|||
|
||||
try
|
||||
{
|
||||
RepositorySystemSession pluginSession =
|
||||
new DefaultRepositorySystemSession( session ).setIgnoreMissingArtifactDescriptor( true );
|
||||
DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
|
||||
pluginSession.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, false ) );
|
||||
|
||||
ArtifactDescriptorRequest request =
|
||||
new ArtifactDescriptorRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
|
||||
|
|
Loading…
Reference in New Issue