geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r388631 - in /geronimo/devtools/eclipse-plugin/trunk: maven-plugins/maven-geronimodevtools-plugin/ maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ plugins/org.apache.geronimo.runtime.v1/
Date Fri, 24 Mar 2006 20:49:29 GMT
Author: sppatel
Date: Fri Mar 24 12:49:27 2006
New Revision: 388631

URL: http://svn.apache.org/viewcvs?rev=388631&view=rev
Log:
generate plugin.xml for runtime plugin

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

Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/pom.xml?rev=388631&r1=388630&r2=388631&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/pom.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/pom.xml
Fri Mar 24 12:49:27 2006
@@ -27,5 +27,10 @@
       <artifactId>maven-install-plugin</artifactId>
       <version>2.1</version>
     </dependency>
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.4</version>
+    </dependency>
   </dependencies>
 </project>

Added: 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=388631&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/PluginDescriptorMojo.java
Fri Mar 24 12:49:27 2006
@@ -0,0 +1,90 @@
+/**
+ * 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 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.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;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File libDir;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File destFile;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private Map contextMap;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.maven.plugin.Mojo#execute()
+	 */
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		try {
+
+			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());
+		}
+	}
+
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pluginXmlTemplate.vm
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pluginXmlTemplate.vm?rev=388631&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pluginXmlTemplate.vm
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.v1/pluginXmlTemplate.vm
Fri Mar 24 12:49:27 2006
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+  id="$id"
+  name="$name"
+  version="$version"
+  provider-name="Apache Software Foundation">
+  <runtime>
+#set($libs = $libDir.listFiles() )
+#foreach( $lib in $libs )
+    <library name="lib/$lib.getName()">
+      <export name="*"/>
+    </library>  
+#end  
+  </runtime>
+</plugin>
\ No newline at end of file

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=388631&r1=388630&r2=388631&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 Mar 24 12:49:27 2006
@@ -139,6 +139,28 @@
           </execution>
         </executions>
       </plugin>
+        <plugin>
+          <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>
+              <phase>process-resources</phase>
+              <goals>
+                <goal>pluginxml</goal>
+              </goals>
+            </execution>
+          </executions>
+      </plugin>
     </plugins>
   </build>
 </project>



Mime
View raw message