Index: src/java/org/apache/maven/MavenSession.java =================================================================== RCS file: /home/cvspublic/maven/src/java/org/apache/maven/MavenSession.java,v retrieving revision 1.18.4.17 diff -u -r1.18.4.17 MavenSession.java --- src/java/org/apache/maven/MavenSession.java 31 Oct 2004 01:01:56 -0000 1.18.4.17 +++ src/java/org/apache/maven/MavenSession.java 7 Dec 2004 14:40:15 -0000 @@ -24,6 +24,7 @@ import java.io.File; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; @@ -260,9 +261,24 @@ */ public void attainGoals( final Project project, final List goals ) throws Exception { - pluginManager.attainGoals( project, goals ); + attainGoals( project, goals, null ); } + /** + * Attain a list of goals. + * + * @param project the project being processed + * @param goals a list of goal names to execute + * @param contextVariables a map of variables to be added to the context + * @throws Exception when anything goes wrong + * @todo don't throw exception + */ + public void attainGoals( final Project project, final List goals, + final Map contextVariables ) throws Exception + { + pluginManager.attainGoals( project, goals, contextVariables ); + } + public Project getPluginProjectFromGoal( String goal ) throws MavenException { return pluginManager.getPluginProjectFromGoal( goal ); Index: src/java/org/apache/maven/plugin/PluginManager.java =================================================================== RCS file: /home/cvspublic/maven/src/java/org/apache/maven/plugin/PluginManager.java,v retrieving revision 1.70.4.61 diff -u -r1.70.4.61 PluginManager.java --- src/java/org/apache/maven/plugin/PluginManager.java 10 Nov 2004 09:20:46 -0000 1.70.4.61 +++ src/java/org/apache/maven/plugin/PluginManager.java 7 Dec 2004 12:33:48 -0000 @@ -529,11 +529,29 @@ */ public void attainGoals( Project project, List goals ) throws Exception { + attainGoals( project, goals, null ); + + } + + /** + * Attain the goals, with some context variables + * + * @throws Exception If one of the specified + * goals refers to an non-existent goal. + * @throws Exception If an exception occurs while running a goal. + * @todo stop throwing Exception + */ + public void attainGoals( Project project, List goals, + final Map contextVariables) throws Exception + { MavenJellyContext prevBaseContext = baseContext; baseContext = new MavenJellyContext( mavenSession.getRootContext() ); baseContext.setInherit( true ); JellyUtils.populateVariables( baseContext, project.getContext() ); + if (contextVariables != null) { + baseContext.getVariables().putAll( contextVariables ); + } project.pushContext( baseContext ); baseContext.setProject( project );