maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r889460 - in /maven/maven-3/trunk/maven-core/src: main/java/org/apache/maven/project/ test/java/org/apache/maven/project/
Date Thu, 10 Dec 2009 23:10:29 GMT
Author: bentmann
Date: Thu Dec 10 23:10:28 2009
New Revision: 889460

URL: http://svn.apache.org/viewvc?rev=889460&view=rev
Log:
[MNG-4489] [regression] Mirror/proxy/auth does not apply to repositories discovered in POMs
of build extensions

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java?rev=889460&r1=889459&r2=889460&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
Thu Dec 10 23:10:28 2009
@@ -22,8 +22,6 @@
 import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
-import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.building.AbstractModelBuildingListener;
 import org.apache.maven.model.building.ModelBuildingEvent;
@@ -105,16 +103,8 @@
         {
             try
             {
-                RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
-                repositoryRequest.setCache( projectBuildingRequest.getRepositoryCache() );
-                repositoryRequest.setLocalRepository( projectBuildingRequest.getLocalRepository()
);
-                repositoryRequest.setRemoteRepositories( pluginRepositories );
-                repositoryRequest.setOffline( projectBuildingRequest.isOffline() );
-                repositoryRequest.setForceUpdate( projectBuildingRequest.isForceUpdate()
);
-                repositoryRequest.setTransferListener( projectBuildingRequest.getTransferListener()
);
-
                 ProjectRealmCache.CacheRecord record =
-                    projectBuildingHelper.createProjectRealm( project, model, repositoryRequest
);
+                    projectBuildingHelper.createProjectRealm( project, model, projectBuildingRequest
);
 
                 project.setClassRealm( record.realm );
                 project.setExtensionArtifactFilter( record.extensionArtifactFilter );

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java?rev=889460&r1=889459&r2=889460&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
Thu Dec 10 23:10:28 2009
@@ -33,6 +33,7 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
 import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
@@ -135,7 +136,7 @@
     }
 
     public synchronized ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project,
Model model,
-                                                                          RepositoryRequest
repositoryRequest )
+                                                                          ProjectBuildingRequest
request )
         throws PluginResolutionException, PluginVersionResolutionException
     {
         ClassRealm projectRealm = null;
@@ -182,6 +183,14 @@
 
         List<Artifact> publicArtifacts = new ArrayList<Artifact>();
 
+        RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
+        repositoryRequest.setCache( request.getRepositoryCache() );
+        repositoryRequest.setLocalRepository( request.getLocalRepository() );
+        repositoryRequest.setRemoteRepositories( project.getPluginArtifactRepositories()
);
+        repositoryRequest.setOffline( request.isOffline() );
+        repositoryRequest.setForceUpdate( request.isForceUpdate() );
+        repositoryRequest.setTransferListener( request.getTransferListener() );
+
         for ( Plugin plugin : extensionPlugins )
         {
             if ( plugin.getVersion() == null )
@@ -201,7 +210,7 @@
             }
             else
             {
-                artifacts = resolveExtensionArtifacts( plugin, repositoryRequest );
+                artifacts = resolveExtensionArtifacts( plugin, repositoryRequest, request
);
 
                 recordArtifacts = pluginArtifactsCache.put( plugin, repositoryRequest, null,
artifacts );
             }
@@ -381,7 +390,8 @@
         return record;
     }
 
-    private List<Artifact> resolveExtensionArtifacts( Plugin extensionPlugin, RepositoryRequest
repositoryRequest )
+    private List<Artifact> resolveExtensionArtifacts( Plugin extensionPlugin, RepositoryRequest
repositoryRequest,
+                                                      ProjectBuildingRequest request )
         throws PluginResolutionException
     {
         Artifact extensionArtifact = repositorySystem.createPluginArtifact( extensionPlugin
);
@@ -396,19 +406,22 @@
 
         ArtifactFilter resolutionFilter = artifactFilterManager.getCoreArtifactFilter();
 
-        ArtifactResolutionRequest request = new ArtifactResolutionRequest( repositoryRequest
);
-        request.setArtifact( extensionArtifact );
-        request.setArtifactDependencies( overrideArtifacts );
-        request.setCollectionFilter( collectionFilter );
-        request.setResolutionFilter( resolutionFilter );
-        request.setResolveRoot( true );
-        request.setResolveTransitively( true );
+        ArtifactResolutionRequest artifactRequest = new ArtifactResolutionRequest( repositoryRequest
);
+        artifactRequest.setArtifact( extensionArtifact );
+        artifactRequest.setArtifactDependencies( overrideArtifacts );
+        artifactRequest.setCollectionFilter( collectionFilter );
+        artifactRequest.setResolutionFilter( resolutionFilter );
+        artifactRequest.setResolveRoot( true );
+        artifactRequest.setResolveTransitively( true );
+        artifactRequest.setServers( request.getServers() );
+        artifactRequest.setMirrors( request.getMirrors() );
+        artifactRequest.setProxies( request.getProxies() );
 
-        ArtifactResolutionResult result = repositorySystem.resolve( request );
+        ArtifactResolutionResult result = repositorySystem.resolve( artifactRequest );
 
         try
         {
-            resolutionErrorHandler.throwErrors( request, result );
+            resolutionErrorHandler.throwErrors( artifactRequest, result );
         }
         catch ( ArtifactResolutionException e )
         {

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java?rev=889460&r1=889459&r2=889460&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
Thu Dec 10 23:10:28 2009
@@ -60,12 +60,12 @@
      * 
      * @param project The project to create the project realm for, must not be {@code null}
      * @param model The model to create the project realm for, must not be {@code null}
-     * @param repositoryRequest The repository request to use for artifact resolution, must
not be {@code null}.
+     * @param request The project building request holding further settings like repository
settings, must not be
+     *            {@code null}.
      * @return The record with the project realm and extension artifact filter, never {@code
null}.
      * @throws PluginResolutionException If any build extension could not be resolved.
      */
-    ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
-                                                      RepositoryRequest repositoryRequest
)
+    ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
ProjectBuildingRequest request )
         throws PluginResolutionException, PluginVersionResolutionException;
 
 }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java?rev=889460&r1=889459&r2=889460&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
(original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
Thu Dec 10 23:10:28 2009
@@ -23,7 +23,6 @@
 import java.util.List;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Repository;
 
@@ -51,7 +50,7 @@
     }
 
     public ProjectRealmCache.CacheRecord createProjectRealm( MavenProject proejct, Model
model,
-                                                             RepositoryRequest repositoryRequest
)
+                                                             ProjectBuildingRequest request
)
     {
         return new ProjectRealmCache.CacheRecord( null, null );
     }



Mime
View raw message