o Tweaked API to express in-situ injection of default mojo configuration values

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@773411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-05-10 21:31:02 +00:00
parent f1f44eb281
commit 4e73077311
4 changed files with 8 additions and 9 deletions

View File

@ -647,7 +647,7 @@ public class DefaultLifecycleExecutor
return plugin; return plugin;
} }
public Set<Plugin> populateDefaultConfigurationForPlugins( Set<Plugin> plugins, MavenProject project, ArtifactRepository localRepository ) public void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins, MavenProject project, ArtifactRepository localRepository )
throws LifecycleExecutionException throws LifecycleExecutionException
{ {
for( Plugin p : plugins ) for( Plugin p : plugins )
@ -661,8 +661,6 @@ public class DefaultLifecycleExecutor
} }
} }
} }
return plugins;
} }
public Xpp3Dom getDefaultPluginConfiguration( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository ) public Xpp3Dom getDefaultPluginConfiguration( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository )

View File

@ -19,6 +19,7 @@ package org.apache.maven.lifecycle;
* under the License. * under the License.
*/ */
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -63,7 +64,7 @@ public interface LifecycleExecutor
// Given a set of {@link org.apache.maven.Plugin} objects where the GAV is set we can lookup the plugin // Given a set of {@link org.apache.maven.Plugin} objects where the GAV is set we can lookup the plugin
// descriptor and populate the default configuration. // descriptor and populate the default configuration.
// //
Set<Plugin> populateDefaultConfigurationForPlugins( Set<Plugin> plugins, MavenProject project, ArtifactRepository localRepository ) void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins, MavenProject project, ArtifactRepository localRepository )
throws LifecycleExecutionException; throws LifecycleExecutionException;
void execute( MavenSession session ) void execute( MavenSession session )

View File

@ -176,9 +176,9 @@ public class DefaultMavenProjectBuilder
// 3. POM values from per-execution configuration // 3. POM values from per-execution configuration
// These configuration sources are given in increasing order of dominance. // These configuration sources are given in increasing order of dominance.
Set<Plugin> processedPlugins = lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() ); lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() );
for ( Plugin buildPlugin : processedPlugins ) for ( Plugin buildPlugin : pluginsFromProject )
{ {
Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration(); Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration();
Plugin x = containsPlugin( buildPlugin, project.getModel().getBuild().getPlugins() ); Plugin x = containsPlugin( buildPlugin, project.getModel().getBuild().getPlugins() );
@ -205,7 +205,7 @@ public class DefaultMavenProjectBuilder
} }
} }
project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( processedPlugins ) ); project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( pluginsFromProject ) );
} }
catch ( IOException e ) catch ( IOException e )
{ {

View File

@ -19,6 +19,7 @@ package org.apache.maven.project;
* under the License. * under the License.
*/ */
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -71,11 +72,10 @@ public class EmptyLifecycleExecutor
return Collections.emptySet(); return Collections.emptySet();
} }
public Set<Plugin> populateDefaultConfigurationForPlugins( Set<Plugin> plugins, MavenProject project, public void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins, MavenProject project,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws LifecycleExecutionException throws LifecycleExecutionException
{ {
return plugins;
} }
} }