smor 2002/11/01 12:56:57
Modified: src/java/org/apache/maven MavenUtils.java
Log:
Added the ability to use project templates, via the "extend" tag.
Templates are found under ${maven.home}/templates/${template-id}/project.xml.
To use this feature, "extend" your project with "template:${template-id}".
When using the "extend" tag, a distributed project won't be able to extend
another project if the directory layouts are different on both systems.
Using templates, you can move around your projects in your system, and Maven
will find its way to the parent project.
Revision Changes Path
1.52 +22 -1 jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java
Index: MavenUtils.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- MavenUtils.java 1 Nov 2002 18:49:12 -0000 1.51
+++ MavenUtils.java 1 Nov 2002 20:56:56 -0000 1.52
@@ -72,6 +72,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.StringTokenizer;
import javax.xml.parsers.SAXParserFactory;
@@ -198,6 +199,26 @@
String pomToExtend = project.getExtend();
if (pomToExtend != null)
{
+ if (pomToExtend.startsWith("template:"))
+ {
+ JellyContext context = null;
+
+ if (parentContext != null)
+ {
+ context = new JellyContext(parentContext);
+ context.setInherit(true);
+ }
+ else
+ {
+ context = new JellyContext();
+ }
+
+ String mavenHome = (String)
context.findVariable(parentContext.MAVEN_HOME);
+ StringTokenizer st = new StringTokenizer(pomToExtend, ":");
+ st.nextToken();
+ pomToExtend = mavenHome + "/templates/" + st.nextToken() +
"/project.xml";
+ }
+
Project parent;
try
{
--
To unsubscribe, e-mail: <mailto:turbine-maven-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-maven-dev-help@;jakarta.apache.org>