maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject [8/50] git commit: o Accounted for refactoring of aether-api
Date Mon, 18 Mar 2013 21:47:28 GMT
o Accounted for refactoring of aether-api


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/02927ead
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/02927ead
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/02927ead

Branch: refs/heads/master
Commit: 02927ead50a1dbf731ff775257c6cd42d6be7a89
Parents: 25a273f
Author: Benjamin Bentmann <bentmann@apache.org>
Authored: Sun Mar 11 23:18:43 2012 +0100
Committer: Benjamin Bentmann <bentmann@apache.org>
Committed: Sun Mar 11 23:18:43 2012 +0100

----------------------------------------------------------------------
 .../internal/DefaultArtifactDescriptorReader.java  |   18 ++++++++++++--
 .../internal/MavenRepositorySystemUtils.java       |    4 +-
 .../AbstractArtifactComponentTestCase.java         |    4 +-
 .../main/java/org/apache/maven/DefaultMaven.java   |    3 +-
 .../DefaultPluginDependenciesResolver.java         |    5 ++-
 5 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/02927ead/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
index 0b4e6d8..60a183c 100644
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
+++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
@@ -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() ) );
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/02927ead/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
index 624e039..c88e341 100644
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -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 );

http://git-wip-us.apache.org/repos/asf/maven/blob/02927ead/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
----------------------------------------------------------------------
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
index 44c2382..ead1d95 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
@@ -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 );
 

http://git-wip-us.apache.org/repos/asf/maven/blob/02927ead/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 1e74cb7..eae73b4 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -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() );

http://git-wip-us.apache.org/repos/asf/maven/blob/02927ead/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
index 6d2b2ff..c4b5fee 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
@@ -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
);


Mime
View raw message