Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8FD02200CD9 for ; Wed, 19 Jul 2017 20:29:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8E5FB1699F0; Wed, 19 Jul 2017 18:29:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B6B5E1699F2 for ; Wed, 19 Jul 2017 20:29:12 +0200 (CEST) Received: (qmail 89469 invoked by uid 500); 19 Jul 2017 18:29:11 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 89460 invoked by uid 99); 19 Jul 2017 18:29:11 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2017 18:29:11 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 63DCB3A01AE for ; Wed, 19 Jul 2017 18:29:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@maven.apache.org From: khmarbaise@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170719182911.63DCB3A01AE@svn01-us-west.apache.org> archived-at: Wed, 19 Jul 2017 18:29:13 -0000 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 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +> 4.0.0 @@ -61,6 +62,8 @@ 3.0 + 1.7 + 1.7 @@ -81,13 +84,12 @@ ${mavenVersion} - commons-lang - commons-lang - 2.4 + org.apache.commons + commons-lang3 + 3.6 - - + @@ -96,5 +98,5 @@ - + 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 khmarbaise@apache.org - * */ 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;