From cad43e6b566ea1830d3e86cf1102c7770b35652e Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 21 May 2009 16:17:15 +0000 Subject: [PATCH] o Fixed precedence of plugin groups (request > settings > defaults) git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@777165 13f79535-47bb-0310-9956-ffa450edef68 --- .../execution/DefaultMavenExecutionRequest.java | 10 ++++++++++ .../maven/execution/MavenExecutionRequest.java | 3 +-- .../DefaultMavenExecutionRequestPopulator.java | 13 +++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 976dd350dd..7ba64ac74b 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -585,6 +585,16 @@ public class DefaultMavenExecutionRequest return this; } + public MavenExecutionRequest addPluginGroups( List pluginGroups ) + { + for ( String pluginGroup : pluginGroups ) + { + addPluginGroup( pluginGroup ); + } + + return this; + } + public boolean isUsePluginUpdateOverride() { return usePluginUpdateOverride; diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 1caa7cb7db..fbf19eafb1 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -23,11 +23,9 @@ import java.io.File; import java.util.Date; import java.util.List; import java.util.Properties; -import java.util.Set; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.model.Plugin; import org.apache.maven.model.Profile; import org.apache.maven.project.ProjectBuilderConfiguration; import org.apache.maven.settings.Settings; @@ -171,6 +169,7 @@ public interface MavenExecutionRequest List getPluginGroups(); MavenExecutionRequest setPluginGroups( List pluginGroups ); MavenExecutionRequest addPluginGroup( String pluginGroup ); + MavenExecutionRequest addPluginGroups( List pluginGroups ); boolean isUsePluginUpdateOverride(); MavenExecutionRequest setUsePluginUpdateOverride( boolean usePluginUpdateOverride ); 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 ca0853c4c9..a3c1ace4f2 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 @@ -16,7 +16,6 @@ package org.apache.maven.embedder.execution; */ import java.io.File; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -57,8 +56,6 @@ public class DefaultMavenExecutionRequestPopulator throws MavenEmbedderException { pom( request, configuration ); - - populateDefaultPluginGroups( request, configuration ); settings( request, configuration ); @@ -105,10 +102,8 @@ public class DefaultMavenExecutionRequestPopulator private void populateDefaultPluginGroups( MavenExecutionRequest request, Configuration configuration ) { - List pluginGroups = new ArrayList(); - pluginGroups.add( "org.apache.maven.plugins" ); - pluginGroups.add( "org.codehaus.mojo" ); - request.setPluginGroups( pluginGroups ); + request.addPluginGroup( "org.apache.maven.plugins" ); + request.addPluginGroup( "org.codehaus.mojo" ); } // Process plugin groups @@ -119,7 +114,9 @@ public class DefaultMavenExecutionRequestPopulator { Settings settings = request.getSettings(); - request.getPluginGroups().addAll( settings.getPluginGroups() ); + request.addPluginGroups( settings.getPluginGroups() ); + + populateDefaultPluginGroups( request, configuration ); List settingsProfiles = settings.getProfiles();