jvanzyl 2002/07/05 16:16:24
Modified: src/java/org/apache/maven/app MavenJellyContext.java
PluginManager.java
Log:
o Create a new MavenJellyContext for each plugin so that we can have
commonly named elements that don't clobber one another.
Revision Changes Path
1.6 +7 -0
jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java
Index: MavenJellyContext.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MavenJellyContext.java 26 Jun 2002 19:09:04 -0000 1.5
+++ MavenJellyContext.java 5 Jul 2002 23:16:24 -0000 1.6
@@ -103,6 +103,13 @@
this.asProps = new JellyProps();
}
+ public MavenJellyContext(MavenJellyContext parent)
+ {
+ super(parent);
+ this.props = parent.props;
+ this.asProps = parent.asProps;
+ }
+
/** Set the Ant project.
*
* @param antProject The ant Project.
1.3 +23 -5
jakarta-turbine-maven/src/java/org/apache/maven/app/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/PluginManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PluginManager.java 5 Jul 2002 21:35:18 -0000 1.2
+++ PluginManager.java 5 Jul 2002 23:16:24 -0000 1.3
@@ -76,6 +76,9 @@
import org.apache.commons.grant.GrantProject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/** Plugin manager for Maven.
*
* <p>
@@ -87,14 +90,17 @@
*/
public class PluginManager
{
- /** ${maven.home}/bin/plugins directory. */
- private File pluginsDir;
-
/** Plug-in main script name. */
public static final String PLUGIN_SCRIPT_NAME = "plugin.jelly";
/** Plug-in default properties name. */
public static final String PLUGIN_PROPERTIES_NAME = "plugin.properties";
+
+ /** Log. */
+ private static final Log log = LogFactory.getLog(Maven.class);
+
+ /** ${maven.home}/bin/plugins directory. */
+ private File pluginsDir;
/** Jelly's output. */
private XMLOutput output;
@@ -171,11 +177,23 @@
// Thread.currentThread().setContextClassLoader(cl);
- getJellyContext().setVariable( "plugin.dir", getPluginDir( name ) );
+ log.debug( "plugin: " + name + " -> " + getPluginDir( name ) );
+
+ // For each plugin we create a new MavenJellyContext so that we
+ // can push in commonly named elements like ${plugin.dir} without
+ // the elements clobbering one another. Make sure to set inheritence
+ // to true so that the outter context has access to variables and
+ // taglibs set in the parent.
+ MavenJellyContext pluginJellyContext = new MavenJellyContext(
getJellyContext() );
+ pluginJellyContext.setInherit(true);
+ pluginJellyContext.setVariable( "plugin.dir", getPluginDir( name ) );
+
+ //System.out.println(">> " + pluginJellyContext);
+ //System.out.println(">> " + getJellyContext());
JellyUtils.runScript(pluginScript,
getPluginDir(name).toURL(),
- getJellyContext(),
+ pluginJellyContext,
getXMLOutput());
// Thread.currentThread().setContextClassLoader(oldCl);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>