Author: kmenard
Date: Fri May 23 16:23:37 2008
New Revision: 659713

URL: http://svn.apache.org/viewvc?rev=659713&view=rev
Log:
Fixed CAY-1058: Add a maven plugin for starting up the modeler.

Added:
    
cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
Modified:
    cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml

Modified: cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml?rev=659713&r1=659712&r2=659713&view=diff
==============================================================================
--- cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml (original)
+++ cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml Fri May 23 
16:23:37 2008
@@ -39,25 +39,25 @@
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-plugin-api</artifactId>
-                       <version>2.0.4</version>
+                       <version>2.0.9</version>
                </dependency>
 
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-artifact</artifactId>
-                       <version>2.0.4</version>
+                       <version>2.0.9</version>
                </dependency>
 
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-project</artifactId>
-                       <version>2.0.4</version>
+                       <version>2.0.9</version>
                </dependency>
 
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-plugin-tools-api</artifactId>
-                       <version>2.0.4</version>
+                       <version>2.0.5</version>
                </dependency>
 
                <!-- even though the runtime dependency is on 'cayenne-server', 
@@ -70,7 +70,13 @@
                        <scope>provided</scope>
                </dependency>
 
-               <dependency>
+        <dependency>
+                       <groupId>org.apache.cayenne</groupId>
+                       <artifactId>cayenne-modeler</artifactId>
+                       <version>${version}</version>
+               </dependency>
+
+        <dependency>
                        <groupId>org.apache.cayenne</groupId>
                        <artifactId>cayenne-server</artifactId>
                        <version>${version}</version>

Added: 
cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java?rev=659713&view=auto
==============================================================================
--- 
cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
 (added)
+++ 
cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
 Fri May 23 16:23:37 2008
@@ -0,0 +1,52 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.cayenne.tools;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.cayenne.modeler.Main;
+
+import java.io.IOException;
+
+/**
+ * Maven mojo to start up the Cayenne modeler from the command-line.
+ * 
+ * @author Kevin Menard
+ * @since 3.0
+ *
+ * @prefix cayenne
+ * @goal modeler
+ */
+public class CayenneModelerMojo extends AbstractMojo {
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        // Start up the modeler.
+        Main.main(new String[]{});
+
+        // Block until the modeler finishes executing.
+        try {
+            Thread.currentThread().join();
+        }
+        catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+}


Reply via email to