geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r384325 - in /geronimo/devtools/eclipse-plugin/trunk: geronimo-emf/pom.xml maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ImportResourcesMojo.java
Date Wed, 08 Mar 2006 20:39:23 GMT
Author: sppatel
Date: Wed Mar  8 12:39:23 2006
New Revision: 384325

URL: http://svn.apache.org/viewcvs?rev=384325&view=rev
Log:
import schemas

Added:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ImportResourcesMojo.java
Modified:
    geronimo/devtools/eclipse-plugin/trunk/geronimo-emf/pom.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/geronimo-emf/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/geronimo-emf/pom.xml?rev=384325&r1=384324&r2=384325&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/geronimo-emf/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/geronimo-emf/pom.xml Wed Mar  8 12:39:23 2006
@@ -1,14 +1,36 @@
 <project>
   <modelVersion>4.0.0</modelVersion>
-    <artifactId>geronimo-emf-common</artifactId>
-    <packaging>jar</packaging>
-    <version>${geronimo-emf-common_version}</version>
-    <name>${artifactId}</name>
-    <parent>
-      <groupId>org.apache.geronimo.devtools</groupId>
-      <artifactId>geronimo-eclipse-plugin</artifactId>
-      <version>1.0</version>
-    </parent>
+  <artifactId>geronimo-emf-common</artifactId>
+  <packaging>jar</packaging>
+  <version>${geronimo-emf-common_version}</version>
+  <name>${artifactId}</name>
+  <parent>
+    <groupId>org.apache.geronimo.devtools</groupId>
+    <artifactId>geronimo-eclipse-plugin</artifactId>
+    <version>1.0</version>
+  </parent>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.geronimo.devtools</groupId>
+        <artifactId>maven-geronimodevtools-plugin</artifactId>
+        <configuration>
+          <targetPath>schema</targetPath>
+          <includes>
+            <include>**/*.xsd</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>importresources</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>openejb</groupId>
@@ -23,42 +45,42 @@
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-security-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-naming-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
-      </dependency>
+      <version>${geronimo_version}</version>
+    </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-web-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-j2ee-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-service-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-j2ee-schema</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-connector-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
     <dependency>
       <groupId>geronimo</groupId>
       <artifactId>geronimo-client-builder</artifactId>
-      <version>${geronimo_runtime_version}</version>
+      <version>${geronimo_version}</version>
     </dependency>
   </dependencies>
 </project>

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ImportResourcesMojo.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/ImportResourcesMojo.java?rev=384325&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ImportResourcesMojo.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ImportResourcesMojo.java
Wed Mar  8 12:39:23 2006
@@ -0,0 +1,143 @@
+/**
+ * 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 java.util.Iterator;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+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.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Delete;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.taskdefs.Move;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.PatternSet;
+
+/**
+ * @goal importresources
+ * @requiresDependencyResolution
+ */
+public class ImportResourcesMojo extends AbstractMojo {
+
+	/**
+	 * @parameter expression="${project}"
+	 * @required
+	 */
+	private MavenProject project;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private String targetPath;
+
+	/**
+	 * @parameter expression="true"
+	 */
+	private boolean flatten;
+
+	/**
+	 * @parameter
+	 */
+	private String[] includes;
+
+	private File importDestination;
+	private File targetDestination;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.maven.plugin.Mojo#execute()
+	 */
+	public void execute() throws MojoExecutionException, MojoFailureException {
+
+		Set dependencies = project.getDependencyArtifacts();
+		Iterator i = dependencies.iterator();
+
+		if (dependencies.size() > 0) {
+
+			while (i.hasNext()) {
+				Artifact artifact = (Artifact) i.next();
+				Expand expandTask = new Expand();
+				expandTask.setProject(new Project());
+				expandTask.setSrc(artifact.getFile());
+				expandTask.setDest(getImportDestination());
+				if (includes != null) {
+					PatternSet set = new PatternSet();
+					for (int j = 0; j < includes.length; j++) {
+						set.setIncludes(includes[j]);
+					}
+					expandTask.addPatternset(set);
+				}
+				expandTask.execute();
+			}
+
+			if (flatten) {
+				flatten();
+				cleanup();
+			}
+		}
+	}
+
+	private void flatten() {
+		Move moveTask = new Move();
+		moveTask.setProject(new Project());
+		moveTask.setTodir(getTargetDestination());
+		moveTask.setFlatten(true);
+
+		if (includes != null) {
+			FileSet fileSet = new FileSet();
+			fileSet.setDir(getImportDestination());
+			for (int j = 0; j < includes.length; j++) {
+				fileSet.setIncludes(includes[j]);
+			}
+			moveTask.addFileset(fileSet);
+		}
+
+		moveTask.execute();
+	}
+
+	private void cleanup() {
+		Delete deleteTask = new Delete();
+		deleteTask.setProject(new Project());
+		deleteTask.setDir(getImportDestination());
+		deleteTask.execute();
+	}
+
+	private File getImportDestination() {
+		if (importDestination == null) {
+			String base = project.getBasedir().getAbsolutePath();
+			if (flatten) {
+				importDestination = new File(base + File.separator + "temp");
+			}
+			importDestination = getTargetDestination();
+		}
+		return importDestination;
+	}
+
+	private File getTargetDestination() {
+		if (targetDestination == null) {
+			String base = project.getBasedir().getAbsolutePath();
+			return new File(base + File.separator + targetPath);
+		}
+		return targetDestination;
+	}
+}



Mime
View raw message