From c5fb845b6b8d4c29de2540d9b9d0ae029c068cff Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Tue, 21 Jul 2009 18:02:07 +0000 Subject: [PATCH] o make sure that the plugin repositories are propagated from the builder request and not from the MavenProject git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@796420 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractArtifactResolutionException.java | 2 +- .../maven/plugin/PluginResolutionException.java | 2 +- .../maven/project/DefaultProjectBuilder.java | 2 +- .../maven/AbstractCoreMavenComponentTestCase.java | 8 +++----- .../DefaultMavenExecutionRequestPopulator.java | 15 +++++++++++++-- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java index 8e4b99cd62..9002c4e5db 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java @@ -79,7 +79,7 @@ public class AbstractArtifactResolutionException Throwable t ) { super( constructMessageBase( message, groupId, artifactId, version, type, remoteRepositories, path ), t ); - + this.originalMessage = message; this.groupId = groupId; this.artifactId = artifactId; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java index 6615ddbabc..b7e139ce4a 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java @@ -37,7 +37,7 @@ public class PluginResolutionException public PluginResolutionException( Plugin plugin, ArtifactResolutionException e ) { - super( "Plugin could not be resolved: " + e.getMessage(), e.getGroupId(), e.getArtifactId(), e.getVersion(), "maven-plugin",null, e.getRemoteRepositories(), null, e.getCause() ); + super( "Plugin could not be resolved: " + e.getMessage(), e.getGroupId(), e.getArtifactId(), e.getVersion(), "maven-plugin", null, e.getRemoteRepositories(), null, e.getCause() ); this.plugin = plugin; } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index 1260595108..92f16d9056 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -151,7 +151,7 @@ public class DefaultProjectBuilder { lifecycle.populateDefaultConfigurationForPlugins( model.getBuild().getPlugins(), configuration.getLocalRepository(), - project.getPluginArtifactRepositories() ); + configuration.getPluginArtifactRepositories() ); } } catch ( LifecycleExecutionException e ) diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java index 2febab0c96..78b68eb4ed 100644 --- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java @@ -83,7 +83,7 @@ public abstract class AbstractCoreMavenComponentTestCase protected MavenExecutionRequest createMavenExecutionRequest( File pom ) throws Exception - { + { MavenExecutionRequest request = new DefaultMavenExecutionRequest() .setPom( pom ).setProjectPresent( true ) .setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) ) @@ -109,7 +109,7 @@ public abstract class AbstractCoreMavenComponentTestCase throws Exception { MavenExecutionRequest request = createMavenExecutionRequest( pom ); - + ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest() .setLocalRepository( request.getLocalRepository() ) .setRemoteRepositories( request.getRemoteRepositories() ) @@ -153,9 +153,7 @@ public abstract class AbstractCoreMavenComponentTestCase Repository itRepo = new Repository(); itRepo.setId( "maven.it" ); itRepo.setUrl( "http://repository.sonatype.org/content/repositories/maven.snapshots" ); - - return Arrays.asList( repositorySystem.buildArtifactRepository( itRepo ), - repositorySystem.createDefaultRemoteRepository() ); + return Arrays.asList( repositorySystem.createDefaultRemoteRepository(), repositorySystem.buildArtifactRepository( itRepo ) ); } protected ArtifactRepository getLocalRepository() diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java index 5993c2cd2a..faf68086ae 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java @@ -29,6 +29,7 @@ import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.MavenSettingsBuilder; import org.apache.maven.settings.Mirror; +import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; import org.apache.maven.settings.SettingsUtils; @@ -146,6 +147,18 @@ public class DefaultMavenExecutionRequestPopulator { Settings settings = request.getSettings(); + // + // + // true + // http + // proxy.somewhere.com + // 8080 + // proxyuser + // somepassword + // www.google.com|*.somewhere.com + // + // + /* Proxy proxy = settings.getActiveProxy(); @@ -163,8 +176,6 @@ public class DefaultMavenExecutionRequestPopulator for ( Server server : settings.getServers() ) { repositorySystem.addAuthenticationForArtifactRepository( server.getId(), server.getUsername(), server.getPassword() ); - - //repositorySystem.addPermissionInfo( server.getId(), server.getFilePermissions(), server.getDirectoryPermissions() ); } for ( Mirror mirror : settings.getMirrors() )