You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/13 15:29:14 UTC

[maven-jlink-plugin] 02/03: Clean up integration test. Set 'sourceJdkModules' parameter type to File.

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJLINK-6
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git

commit 6ef114368e04f1de391403fa30be406db0bfaf4a
Author: Andre Tadeu de Carvalho <an...@gmail.com>
AuthorDate: Fri Jan 11 16:10:12 2019 -0200

    Clean up integration test. Set 'sourceJdkModules' parameter type to File.
---
 src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml  |  6 ++--
 .../MJLINK-6_allowSetJmodPath/verify.groovy        | 36 ++++++----------------
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  |  5 ++-
 3 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
index 44b3163..8839569 100644
--- a/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
@@ -26,8 +26,8 @@
   <artifactId>maven-jlink-plugin-mjlink-6</artifactId>
   <version>96.0</version>
   <packaging>jlink</packaging>
-  <name>Maven</name>
-  <url>https://maven.apache.org</url>
+  <url>https://issues.apache.org/jira/browse/MJLINK-6</url>
+
   <description>Test JLink create a distributable JVM that is not currently used</description>
   <properties>
     <maven.compiler.source>1.9</maven.compiler.source>
@@ -51,7 +51,7 @@
         <version>@project.version@</version>
         <extensions>true</extensions>
         <configuration>
-          <!-- <sourceJdkModules>/home/andre/Desktop/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1</sourceJdkModules> -->
+          <sourceJdkModules>${java.home}</sourceJdkModules>
         </configuration>
       </plugin>
     </plugins>
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
index f03fb3d..dd8f904 100644
--- a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
@@ -18,33 +18,15 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
+import java.io.*
+import java.util.*
+import java.util.jar.*
+import org.codehaus.plexus.util.*
 
-boolean result = true;
+File target = new File( basedir, "target" );
+assert target.isDirectory()
 
-try
-{
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() )
-    {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
-    File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
-    if ( !artifact.exists() || artifact.isDirectory() )
-    {
-        System.err.println( "maven-jlink-plugin-mjlink-26-96.0.zip file is missing or is a directory." );
-        return false;
-    }
+File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
+assert artifact.isFile()
 
-}
-catch( Throwable e )
-{
-    e.printStackTrace();
-    result = false;
-}
-
-return result;
+return true
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index a5f69fa..137c6b8 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -30,7 +30,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -245,7 +244,7 @@ public class JLinkMojo
      * Set the JDK location to create a Java custom runtime image.
      */
     @Parameter
-    private String sourceJdkModules;
+    private File sourceJdkModules;
 
     /**
      * Name of the generated ZIP file in the <code>target</code> directory. This will not change the name of the
@@ -268,7 +267,7 @@ public class JLinkMojo
         // Really Hacky...do we have a better solution to find the jmods directory of the JDK?
         File jLinkParent = jLinkExecuteable.getParentFile().getParentFile();
         File jmodsFolder;
-        if ( StringUtils.isNotBlank( sourceJdkModules ) )
+        if ( sourceJdkModules != null && sourceJdkModules.isDirectory() )
         {
             jmodsFolder = new File ( sourceJdkModules, JMODS );
         }