brett 2004/11/06 01:11:37 Modified: src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH PluginManager.java Log: PR: MAVEN-1467
Properly initialise plugin properties, so maven:set will work even before goal attainment. This is ugly, but the correction requires a break in backwards compatibility. We may be able to achieve this in 1.1 Revision Changes Path No revision No revision 1.70.4.59 +25 -4 maven/src/java/org/apache/maven/plugin/PluginManager.java Index: PluginManager.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v retrieving revision 1.70.4.58 retrieving revision 1.70.4.59 diff -u -r1.70.4.58 -r1.70.4.59 --- PluginManager.java 6 Nov 2004 07:52:47 -0000 1.70.4.58 +++ PluginManager.java 6 Nov 2004 09:11:37 -0000 1.70.4.59 @@ -56,6 +56,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; /* @@ -727,12 +728,32 @@ Project project = housing.getProject(); // TODO: I think this should merge into pluginContext, but that seems to break existing jelly as it depends on - // that kind of warped scoping - MavenUtils.integrateMapInContext( housing.getPluginProperties(), baseContext ); + // that kind of warped scoping. Fix this in 1.1 +// MavenUtils.integrateMapInContext( housing.getPluginProperties(), baseContext ); + + // Instead, we must go through each property and merge from previous plugin contexts, or the original property + // first integrate new ones + MavenUtils.integrateMapInContext( project.getContext().getVariables(), baseContext ); + // now integrate properties that have a new value + Properties p = new Properties(); + for ( Iterator i = housing.getPluginProperties().keySet().iterator(); i.hasNext(); ) + { + String key = (String) i.next(); + Object value = project.getContext().getVariable( key ); + if ( value != null ) + { + baseContext.setVariable( key, value ); + } + else + { + p.setProperty( key, (String) housing.getPluginProperties().get( key ) ); + } + } + MavenUtils.integrateMapInContext( p, baseContext ); + // but leave alone anything in there that is not a plugin property, and already exists in baseContext // TODO necessary to create a new one every time? MavenJellyContext pluginContext = new MavenJellyContext( baseContext ); - //MavenUtils.integrateMapInContext( project.getContext().getVariables(), pluginContext ); project.pushContext( pluginContext ); pluginContext.setInherit( true ); pluginContext.setVariable( "context", pluginContext ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]