You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/05/15 18:11:35 UTC

svn commit: r538238 - in /maven/continuum/trunk: ./ maven-continuum-plugin/ maven-continuum-plugin/src/ maven-continuum-plugin/src/main/ maven-continuum-plugin/src/main/java/ maven-continuum-plugin/src/main/java/org/ maven-continuum-plugin/src/main/jav...

Author: evenisse
Date: Tue May 15 09:11:33 2007
New Revision: 538238

URL: http://svn.apache.org/viewvc?view=rev&rev=538238
Log:
Start Continuum plugin

Added:
    maven/continuum/trunk/maven-continuum-plugin/   (with props)
    maven/continuum/trunk/maven-continuum-plugin/pom.xml   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/
    maven/continuum/trunk/maven-continuum-plugin/src/main/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java   (with props)
Modified:
    maven/continuum/trunk/pom.xml

Propchange: maven/continuum/trunk/maven-continuum-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 15 09:11:33 2007
@@ -0,0 +1,2 @@
+target
+*.iml

Added: maven/continuum/trunk/maven-continuum-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/pom.xml?view=auto&rev=538238
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/pom.xml (added)
+++ maven/continuum/trunk/maven-continuum-plugin/pom.xml Tue May 15 09:11:33 2007
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  
+  <parent>
+    <artifactId>continuum-parent</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-continuum-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>Maven Continuum Plugin</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-xmlrpc-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/continuum/trunk/maven-continuum-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java?view=auto&rev=538238
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java Tue May 15 09:11:33 2007
@@ -0,0 +1,85 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.continuum.xmlrpc.client.ContinuumXmlRpcClient;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public abstract class AbstractContinuumMojo
+    extends AbstractMojo
+{
+    /**
+     * The Continuum XML-RPC server URL.
+     *
+     * @parameter expression="${url}"
+     */
+    private String url;
+
+    /**
+     * The Continuum username.
+     *
+     * @parameter expression="${username}"
+     */
+    private String username;
+
+    /**
+     * The Continuum password.
+     *
+     * @parameter expression="${password}"
+     */
+    private String password;
+
+    private ContinuumXmlRpcClient client;
+
+    protected void createClient()
+        throws MojoExecutionException
+    {
+        URL continuumUrl;
+
+        try
+        {
+            continuumUrl = new URL( url );
+        }
+        catch ( MalformedURLException e )
+        {
+            throw new MojoExecutionException( "The URL '" + url + "' isn't valid." );
+        }
+
+        client = new ContinuumXmlRpcClient( continuumUrl, username, password );
+    }
+
+    protected ContinuumXmlRpcClient getClient()
+        throws MojoExecutionException
+    {
+        if ( client == null )
+        {
+            createClient();
+        }
+        return client;
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java?view=auto&rev=538238
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java Tue May 15 09:11:33 2007
@@ -0,0 +1,65 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Goal which add a Maven2 project.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @goal add-maven-two-project
+ */
+public class AddMavenTwoProject
+    extends AbstractContinuumMojo
+{
+    /**
+     * @parameter expression="${projectUrl}"
+     */
+    private String projectUrl;
+
+    /**
+     * @parameter expression="${projectGroupId}"
+     */
+    private String projectGroupId;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            if ( projectGroupId != null && projectGroupId.length() > 0 )
+            {
+                getClient().addMavenTwoProject( projectUrl, Integer.parseInt( projectGroupId ) );
+            }
+            else
+            {
+                getClient().addMavenTwoProject( projectUrl );
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            throw new MojoExecutionException( "Can't add the Maven2 project from '" + projectUrl + "'.", e );
+        }
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java?view=auto&rev=538238
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java Tue May 15 09:11:33 2007
@@ -0,0 +1,48 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Goal which ping the Continuum server.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @goal ping
+ */
+public class PingMojo
+    extends AbstractContinuumMojo
+{
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            getClient().ping();
+        }
+        catch ( ContinuumException e )
+        {
+            throw new MojoExecutionException( "Can't run the continuum command.", e );
+        }
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/PingMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/continuum/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/pom.xml?view=diff&rev=538238&r1=538237&r2=538238
==============================================================================
--- maven/continuum/trunk/pom.xml (original)
+++ maven/continuum/trunk/pom.xml Tue May 15 09:11:33 2007
@@ -17,7 +17,8 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.maven</groupId>
@@ -100,6 +101,7 @@
     <module>continuum-release</module>
     <module>continuum-data-management</module>
     <module>continuum-configuration</module>
+    <module>maven-continuum-plugin</module>
   </modules>
   <repositories>
     <repository>
@@ -546,7 +548,7 @@
     <profile>
       <id>integration</id>
       <modules>
-        <module>continuum-webapp-test</module> 
+        <module>continuum-webapp-test</module>
       </modules>
     </profile>
   </profiles>