geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r432944 - in /geronimo/genesis/trunk/plugins: ./ plugin-support/src/main/java/org/apache/geronimo/plugin/ tools-maven-plugin/ tools-maven-plugin/src/ tools-maven-plugin/src/main/ tools-maven-plugin/src/main/java/ tools-maven-plugin/src/main...
Date Sun, 20 Aug 2006 06:49:30 GMT
Author: jdillon
Date: Sat Aug 19 23:49:26 2006
New Revision: 432944

URL: http://svn.apache.org/viewvc?rev=432944&view=rev
Log:
Adding tools-maven-plugin, currently with one goal: require-java-version
This allows builds to fail quickly if the JVM invoking is incorrect
Uses MacOS style handling of + and * suffix tokens

Added:
    geronimo/genesis/trunk/plugins/tools-maven-plugin/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml   (with props)
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
  (with props)
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml   (with props)
Modified:
    geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/plugin/MojoSupport.java
    geronimo/genesis/trunk/plugins/pom.xml

Modified: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/plugin/MojoSupport.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/plugin/MojoSupport.java?rev=432944&r1=432943&r2=432944&view=diff
==============================================================================
--- geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/plugin/MojoSupport.java
(original)
+++ geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/plugin/MojoSupport.java
Sat Aug 19 23:49:26 2006
@@ -42,11 +42,16 @@
             doExecute();
         }
         catch (Exception e) {
+            //
+            // NOTE: Wrap to avoid truncating the stacktrace
+            //
             if (e instanceof MojoExecutionException) {
-                throw (MojoExecutionException)e;
+                throw new MojoExecutionException(e.getMessage(), e);
             }
             else if (e instanceof MojoFailureException) {
-                throw (MojoFailureException)e;
+                MojoFailureException x = new MojoFailureException(e.getMessage());
+                x.initCause(e);
+                throw x;
             }
             else {
                 throw new MojoExecutionException(e.getMessage(), e);

Modified: geronimo/genesis/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/pom.xml?rev=432944&r1=432943&r2=432944&view=diff
==============================================================================
--- geronimo/genesis/trunk/plugins/pom.xml (original)
+++ geronimo/genesis/trunk/plugins/pom.xml Sat Aug 19 23:49:26 2006
@@ -72,6 +72,20 @@
     </dependencies>
     
     <build>
+        <extensions>
+            <extension>
+                <groupId>org.apache.geronimo.genesis.config</groupId>
+                <artifactId>clover-config</artifactId>
+                <version>${pom.version}</version>
+            </extension>
+            
+            <extension>
+                <groupId>org.apache.geronimo.genesis.config</groupId>
+                <artifactId>checkstyle-config</artifactId>
+                <version>${pom.version}</version>
+            </extension>
+        </extensions>
+        
         <pluginManagement>
             <plugins>
                 <plugin>
@@ -85,6 +99,7 @@
     
     <modules>
         <module>plugin-support</module>
+        <module>tools-maven-plugin</module>
     </modules>
     
     <reporting>
@@ -165,6 +180,12 @@
                     <!-- Pulled as resource from checkstyle-config plugin -->
                     <configLocation>org/apache/geronimo/checkstyle.xml</configLocation>
                 </configuration>
+            </plugin>
+            
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.1</version>
             </plugin>
         </plugins>
     </reporting>

Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml?rev=432944&view=auto
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml (added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml Sat Aug 19 23:49:26 2006
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 The Apache Software Foundation
+    
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<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.geronimo.genesis.plugins</groupId>
+        <artifactId>plugins</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>tools-maven-plugin</artifactId>
+    <name>Genesis Plugins :: Tools</name>
+    <packaging>maven-plugin</packaging>
+    
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.apache.geronimo.genesis.plugins</groupId>
+            <artifactId>plugin-support</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.1</version>
+        </dependency>
+        
+    </dependencies>
+    
+</project>
+

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java?rev=432944&view=auto
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
(added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
Sat Aug 19 23:49:26 2006
@@ -0,0 +1,98 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  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.genesis.plugins.tools;
+
+import org.apache.geronimo.plugin.MojoSupport;
+
+import org.apache.commons.lang.SystemUtils;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Forces the build to fail if the version of Java is not compatible.
+ *
+ * @goal require-java-version
+ * @phase validate
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequireJavaVersionMojo
+    extends MojoSupport
+{
+    /**
+     * Specify the required version of Java (1.1, 1.2, 1.3, 1.4, 1.5).
+     *
+     * Can specify a suffix of '+' to allow any version equal to or newer or '*'
+     * to allow versions in the same group.
+     *
+     * For example, version=1.4+ would be allowed on a JDK 1.5 VM, version=1.5*
+     * would allow any JDK 1.5, but not JDK 1.6.
+     *
+     * @parameter
+     * @required
+     */
+    private String version = null;
+    
+    /**
+     * Flag to skip the version check.
+     *
+     * @parameter default-value="false"
+     */
+    private boolean skip = false;
+    
+    protected void doExecute() throws Exception {
+        if (skip) {
+            log.warn("Skipping Java version check");
+        }
+        
+        version = version.trim();
+        
+        if (version.endsWith("*")) {
+            version = version.substring(0, version.length() - 1).trim();
+            
+            log.debug("Checking Java version is in the same group as: " + version);
+            
+            String tmp = SystemUtils.JAVA_VERSION_TRIMMED;
+            if (!tmp.startsWith(version)) {
+                throw new MojoFailureException("This build requires Java version " + version
+ 
+                    " or a greater version in the same group, found version: " + 
+                    SystemUtils.JAVA_VERSION_FLOAT);
+            }
+        }
+        else if (version.endsWith("+")) {
+            version = version.substring(0, version.length() - 1).trim();
+            
+            log.debug("Checking Java version is greater than: " + version);
+            
+            float tmp = Float.parseFloat(version);
+            if (tmp >= SystemUtils.JAVA_VERSION_FLOAT) {
+                throw new MojoFailureException("This build requires Java version " + version
+ 
+                    " or greater, found version: " + SystemUtils.JAVA_VERSION_FLOAT);
+            }
+        }
+        else {
+            log.debug("Checking Java version is equal to: " + version);
+            
+            float tmp = Float.parseFloat(version);
+            
+            if (tmp != SystemUtils.JAVA_VERSION_FLOAT) {
+                throw new MojoFailureException("This build requires Java version " + version
+ 
+                    ", found version: " + SystemUtils.JAVA_VERSION_FLOAT);
+            }
+        }
+    }
+}

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireJavaVersionMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt?rev=432944&view=auto
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt (added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/apt/usage.apt Sat Aug 19 23:49:26
2006
@@ -0,0 +1,79 @@
+ ------
+ Genesis Tools Plugin for Maven 2
+ ------
+ ???
+ ------
+ ???
+
+Basic Usage
+
+* Require a specific Java version
+
+ This will only allow the build to function if the Java version is 1.4.1, any other version
will cause a build failure.
+
++----------+
+<plugin>
+    <groupId>org.apache.geronimo.genesis.plugins</groupId>
+    <artifactId>tools-maven-plugin</artifactId>
+    <executions>
+        <execution>
+            <phase>validate</phase>
+            <goals>
+                <goal>require-java-version</goal>
+            </goals>
+            <configuration>
+                <version>1.41</version>
+            </configuration>
+        </execution>
+    </executions>
+</plugin>
++----------+
+
+* Require Java version equal to or greater than a given version
+
+ This will only allow the build to function if the Java version is 1.4 or grater.
+
+ For example 1.4.1 or 1.5, but not 1.3.
+
++----------+
+<plugin>
+    <groupId>org.apache.geronimo.genesis.plugins</groupId>
+    <artifactId>tools-maven-plugin</artifactId>
+    <executions>
+        <execution>
+            <phase>validate</phase>
+            <goals>
+                <goal>require-java-version</goal>
+            </goals>
+            <configuration>
+                <version>1.4+</version>
+            </configuration>
+        </execution>
+    </executions>
+</plugin>
++----------+
+
+* Require Java version equal to or greater than a given version in the same group
+
+ This will only allow the build to function if the Java version is 1.4 or grater in the same
group.
+
+ For example 1.4.1 or 1.4.2, but not 1.5.
+
++----------+
+<plugin>
+    <groupId>org.apache.geronimo.genesis.plugins</groupId>
+    <artifactId>tools-maven-plugin</artifactId>
+    <executions>
+        <execution>
+            <phase>validate</phase>
+            <goals>
+                <goal>require-java-version</goal>
+            </goals>
+            <configuration>
+                <version>1.4*</version>
+            </configuration>
+        </execution>
+    </executions>
+</plugin>
++----------+
+

Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml?rev=432944&view=auto
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml (added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml Sat Aug 19 23:49:26
2006
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 The Apache Software Foundation
+
+    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.
+-->
+
+<!-- $Id$ -->
+
+<project name="${project.name}">
+    
+    <body>
+        
+        ${parentProject}
+        
+        ${modules}
+        
+        <menu name="${project.name}">
+            <item name="Overview" href="index.html"/>
+            <item name="Usage" href="usage.html"/>
+            <item name="Configuration" href="plugin-info.html"/>
+        </menu>
+        
+        ${reports}
+        
+    </body>
+
+</project>
+
+

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message