maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject svn commit: r1802423 - in /maven/plugins/trunk/maven-jmod-plugin: pom.xml src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
Date Wed, 19 Jul 2017 18:29:11 GMT
Author: khmarbaise
Date: Wed Jul 19 18:29:11 2017
New Revision: 1802423

URL: http://svn.apache.org/viewvc?rev=1802423&view=rev
Log:
Get this running on JDK 9 and
don't fail with IndexOutOfBoundsException
based on commons-lang 2.4 usage.

Modified:
    maven/plugins/trunk/maven-jmod-plugin/pom.xml
    maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
    maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java

Modified: maven/plugins/trunk/maven-jmod-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/pom.xml?rev=1802423&r1=1802422&r2=1802423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-jmod-plugin/pom.xml Wed Jul 19 18:29:11 2017
@@ -20,7 +20,8 @@
 -->
 
 <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/xsd/maven-4.0.0.xsd">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -61,6 +62,8 @@
 
   <properties>
     <mavenVersion>3.0</mavenVersion>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
   </properties>
 
   <dependencies>
@@ -81,13 +84,12 @@
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <version>2.4</version>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.6</version>
     </dependency>
-    
   </dependencies>
-  
+
   <build>
     <resources>
       <resource>
@@ -96,5 +98,5 @@
       </resource>
     </resources>
   </build>
-  
+
 </project>

Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java?rev=1802423&r1=1802422&r2=1802423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
(original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
Wed Jul 19 18:29:11 2017
@@ -23,7 +23,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.commons.lang.SystemUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -38,9 +38,7 @@ import org.codehaus.plexus.util.cli.Comm
 import org.codehaus.plexus.util.cli.Commandline;
 
 /**
- * 
  * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
- *
  */
 public abstract class AbstractJModMojo
     extends AbstractMojo
@@ -54,8 +52,9 @@ public abstract class AbstractJModMojo
 
     @Component
     private ToolchainManager toolchainManager;
-    
-    protected String getJModExecutable() throws IOException
+
+    protected String getJModExecutable()
+        throws IOException
     {
         Toolchain tc = getToolchain();
 
@@ -85,8 +84,7 @@ public abstract class AbstractJModMojo
 
             if ( !jLinkExe.isFile() )
             {
-                throw new IOException( "The jlink executable '" + jLinkExe
-                    + "' doesn't exist or is not a file." );
+                throw new IOException( "The jlink executable '" + jLinkExe + "' doesn't exist
or is not a file." );
             }
             return jLinkExe.getAbsolutePath();
         }
@@ -96,25 +94,7 @@ public abstract class AbstractJModMojo
         // By default, System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME
         // should be in the JDK_HOME
         // ----------------------------------------------------------------------
-        // For IBM's JDK 1.2 
-        // Really ?
-        if ( SystemUtils.IS_OS_AIX )
-        {
-            jLinkExe =
-                new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator
+ "sh", jLinkCommand );
-        }
-        // For Apple's JDK 1.6.x (and older?) on Mac OSX
-        // CHECKSTYLE_OFF: MagicNumber
-        else if ( SystemUtils.IS_OS_MAC_OSX && SystemUtils.JAVA_VERSION_FLOAT <
1.7f )
-        // CHECKSTYLE_ON: MagicNumber
-        {
-            jLinkExe = new File( SystemUtils.getJavaHome() + File.separator + "bin", jLinkCommand
);
-        }
-        else
-        {
-            jLinkExe =
-                new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator
+ "bin", jLinkCommand );
-        }
+        jLinkExe = new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator
+ "bin", jLinkCommand );
 
         // ----------------------------------------------------------------------
         // Try to find jlink from JAVA_HOME environment variable
@@ -145,7 +125,7 @@ public abstract class AbstractJModMojo
 
         return jLinkExe.getAbsolutePath();
     }
-    
+
     protected boolean projectHasAlreadySetAnArtifact()
     {
         if ( getProject().getArtifact().getFile() != null )
@@ -157,8 +137,9 @@ public abstract class AbstractJModMojo
             return false;
         }
     }
-    
-    protected void executeCommand ( Commandline cmd, File outputDirectory ) throws MojoExecutionException
+
+    protected void executeCommand( Commandline cmd, File outputDirectory )
+        throws MojoExecutionException
     {
         if ( getLog().isDebugEnabled() )
         {
@@ -178,7 +159,7 @@ public abstract class AbstractJModMojo
             {
                 if ( StringUtils.isNotEmpty( output ) )
                 {
-                    //Reconsider to use WARN / ERROR ?
+                    // Reconsider to use WARN / ERROR ?
                     getLog().info( output );
                 }
 
@@ -205,7 +186,7 @@ public abstract class AbstractJModMojo
         }
 
     }
-    
+
     private Toolchain getToolchain()
     {
         Toolchain tc = null;
@@ -227,5 +208,4 @@ public abstract class AbstractJModMojo
         return session;
     }
 
-
 }

Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java?rev=1802423&r1=1802422&r2=1802423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
(original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
Wed Jul 19 18:29:11 2017
@@ -23,7 +23,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.commons.lang.SystemUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;



Mime
View raw message