You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/04/14 17:04:34 UTC

svn commit: r394114 - in /geronimo/devtools/eclipse-plugin/trunk: maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ plugins/org.apache.geronimo.runtime.v1/

Author: sppatel
Date: Fri Apr 14 08:04:31 2006
New Revision: 394114

URL: http://svn.apache.org/viewcvs?rev=394114&view=rev
Log:
generate correct .classpath

Added:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java   (with props)
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java   (with props)
Removed:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/.classpath
Modified:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pom.xml

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java?rev=394114&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java Fri Apr 14 08:04:31 2006
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.eclipse.devtools;
+
+import java.io.File;
+
+import org.apache.velocity.VelocityContext;
+
+/**
+ * @goal classpath
+ */
+public class ClasspathMojo extends VelocityMojo {
+	
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File libDir;
+
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.eclipse.devtools.VelocityMojo#configureContext(org.apache.velocity.VelocityContext)
+	 */
+	public void configureContext(VelocityContext context) {
+		context.put("libDir", libDir);
+	}
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ClasspathMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java?rev=394114&r1=394113&r2=394114&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java Fri Apr 14 08:04:31 2006
@@ -15,30 +15,16 @@
  */
 package org.apache.geronimo.eclipse.devtools;
 
-import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileWriter;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
 
 /**
  * @goal pluginxml
  */
-public class PluginDescriptorMojo extends AbstractMojo {
-
-	/**
-	 * @parameter
-	 * @required
-	 */
-	private String templateFile;
+public class PluginDescriptorMojo extends VelocityMojo {
 
 	/**
 	 * @parameter
@@ -50,48 +36,17 @@
 	 * @parameter
 	 * @required
 	 */
-	private File destFile;
-
-	/**
-	 * @parameter
-	 * @required
-	 */
 	private Map contextMap;
-	
-	/**
-	 * @parameter expression="${project}"
-	 * @required
-	 */
-	private MavenProject project;
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.maven.plugin.Mojo#execute()
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.eclipse.devtools.VelocityMojo#configureContext(org.apache.velocity.VelocityContext)
 	 */
-	public void execute() throws MojoExecutionException, MojoFailureException {
-		try {
-
-			Velocity.setProperty("file.resource.loader.path", project.getBasedir().getAbsolutePath());
-			Velocity.init();
-
-			VelocityContext context = new VelocityContext();
-
-			context.put("libDir", libDir);
-			Iterator i = contextMap.keySet().iterator();
-			while (i.hasNext()) {
-				Object o = i.next();
-				context.put((String) o, contextMap.get(o));
-			}
-
-			Template template = Velocity.getTemplate(templateFile);
-
-			BufferedWriter writer = new BufferedWriter(new FileWriter(destFile));
-			template.merge(context, writer);
-			writer.flush();
-			writer.close();
-		} catch (Exception e) {
-			throw new MojoExecutionException(e.getMessage());
+	public void configureContext(VelocityContext context) {
+		context.put("libDir", libDir);
+		Iterator i = contextMap.keySet().iterator();
+		while (i.hasNext()) {
+			Object o = i.next();
+			context.put((String) o, contextMap.get(o));
 		}
 	}
 

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java?rev=394114&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java Fri Apr 14 08:04:31 2006
@@ -0,0 +1,77 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.eclipse.devtools;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+public abstract class VelocityMojo extends AbstractMojo {
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private String templateFile;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File destFile;
+	
+	/**
+	 * @parameter expression="${project}"
+	 * @required
+	 */
+	private MavenProject project;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.maven.plugin.Mojo#execute()
+	 */
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		try {
+
+			Velocity.setProperty("file.resource.loader.path", project.getBasedir().getAbsolutePath());
+			Velocity.init();
+
+			VelocityContext context = new VelocityContext();
+			configureContext(context);
+
+			Template template = Velocity.getTemplate(templateFile);
+			
+			BufferedWriter writer = new BufferedWriter(new FileWriter(destFile));
+			template.merge(context, writer);
+			writer.flush();
+			writer.close();
+		} catch (Exception e) {
+			throw new MojoExecutionException(e.getMessage());
+		}
+	}
+	
+	abstract public void configureContext(VelocityContext context);
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/VelocityMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pom.xml?rev=394114&r1=394113&r2=394114&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pom.xml Fri Apr 14 08:04:31 2006
@@ -143,21 +143,35 @@
         <groupId>org.apache.geronimo.devtools</groupId>
         <artifactId>maven-geronimodevtools-plugin</artifactId>
         <configuration>
-          <templateFile>pluginXmlTemplate.vm</templateFile>
-          <destFile>plugin.xml</destFile>
           <libDir>lib</libDir>
-          <contextMap>
-            <id>${artifactId}</id>
-            <name>Apache Geronimo Runtime V${version} Plug-in</name>
-            <version>${version}</version>
-          </contextMap>
         </configuration>
         <executions>
           <execution>
+            <id>generate-plugin-descriptor</id>
             <phase>process-resources</phase>
             <goals>
               <goal>pluginxml</goal>
             </goals>
+            <configuration>
+              <templateFile>pluginXmlTemplate.vm</templateFile>
+              <destFile>plugin.xml</destFile>
+              <contextMap>
+                <id>${artifactId}</id>
+                <name>Apache Geronimo Runtime V${version} Plug-in</name>
+                <version>${version}</version>
+              </contextMap>
+            </configuration>
+          </execution>
+          <execution>
+            <id>generate-classpath</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>classpath</goal>
+            </goals>
+            <configuration>
+              <templateFile>classpathXmlTemplate.vm</templateFile>
+              <destFile>.classpath</destFile>
+            </configuration>
           </execution>
         </executions>
       </plugin>