geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r508204 - /geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java
Date Thu, 15 Feb 2007 22:26:30 GMT
Author: jdillon
Date: Thu Feb 15 14:26:29 2007
New Revision: 508204

URL: http://svn.apache.org/viewvc?view=rev&rev=508204
Log:
Minor clean up

Modified:
    geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java

Modified: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java?view=diff&rev=508204&r1=508203&r2=508204
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java
(original)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/RequireMavenVersionMojo.java
Thu Feb 15 14:26:29 2007
@@ -57,12 +57,12 @@
      */
     private boolean skip = false;
     
-    /**
-     * The version of Maven we are running in.
-     */
-    private String mavenVersion;
-    
-    private Properties loadProperties() throws Exception {
+    private String loadMavenVersion() throws Exception {
+        //
+        // HACK: Not sure where is the best place to get the Maven version from, so pull
it from
+        //       the maven-core's pom details until we find a better way.
+        //
+        
         InputStream input = getClass().getClassLoader().getResourceAsStream("META-INF/maven/org.apache.maven/maven-core/pom.properties");
         if (input == null) {
             throw new MojoFailureException("Missing 'maven-core/pom.properties', can't find
Maven version");
@@ -76,7 +76,12 @@
             input.close();
         }
         
-        return props;
+        String version = props.getProperty("version");
+        if (version == null) {
+            throw new MojoFailureException("Missing 'version' property in 'maven-core/pom.properties'");
+        }
+        
+        return version;
     }
     
     /**
@@ -111,13 +116,8 @@
             log.warn("Skipping Maven version check");
         }
         
-        Properties props = loadProperties();
-        mavenVersion = props.getProperty("version");
-        if (mavenVersion == null) {
-            throw new MojoFailureException("Missing 'version' property in 'maven-core/pom.properties'");
-        }
+        String mavenVersion = loadMavenVersion();
         log.debug("Current Maven version: " + mavenVersion);
-        
         float mavenVersionFloat = parseFloat(mavenVersion);
         
         version = version.trim();



Mime
View raw message