You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2017/08/17 19:38:52 UTC

svn commit: r1805333 - in /maven/plugins/trunk/maven-jlink-plugin: pom.xml src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java

Author: khmarbaise
Date: Thu Aug 17 19:38:52 2017
New Revision: 1805333

URL: http://svn.apache.org/viewvc?rev=1805333&view=rev
Log:
Upgraded maven-archiver 3.2.0, plexus-archiver 3.5
Improved code.

Modified:
    maven/plugins/trunk/maven-jlink-plugin/pom.xml
    maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
    maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java

Modified: maven/plugins/trunk/maven-jlink-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/pom.xml?rev=1805333&r1=1805332&r2=1805333&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-jlink-plugin/pom.xml Thu Aug 17 19:38:52 2017
@@ -85,12 +85,12 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-archiver</artifactId>
-      <version>3.1.1</version>
+      <version>3.2.0</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-archiver</artifactId>
-      <version>3.4</version>
+      <version>3.5</version>
     </dependency> 
     <dependency>
       <groupId>org.apache.commons</groupId>

Modified: maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java?rev=1805333&r1=1805332&r2=1805333&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java (original)
+++ maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java Thu Aug 17 19:38:52 2017
@@ -77,6 +77,7 @@ public abstract class AbstractJLinkMojo
             jLinkExecutable = tc.findTool( "jlink" );
         }
 
+        //TODO: Check if there exist a more elegant way?
         String jLinkCommand = "jlink" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" );
 
         File jLinkExe;

Modified: maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java?rev=1805333&r1=1805332&r2=1805333&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java (original)
+++ maven/plugins/trunk/maven-jlink-plugin/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java Thu Aug 17 19:38:52 2017
@@ -112,7 +112,7 @@ public class JLinkMojo
     private Integer compression;
 
     /**
-     * Limit the univers of observable modules. <code>--limit-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>
+     * Limit the universe of observable modules. <code>--limit-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>
      */
     @Parameter
     private List<String> limitModules;
@@ -143,7 +143,6 @@ public class JLinkMojo
     /**
      * Byte order of generated jimage (default:native). <code>--endian &lt;little|big&gt;</code>.
      * </p>
-     * TODO: Reconsider setting the default value? Hasn't that been set already?
      */
     @Parameter( defaultValue = "native" )
     private String endian;
@@ -221,22 +220,14 @@ public class JLinkMojo
         throws MojoExecutionException, MojoFailureException
     {
 
-        String jLinkExec;
-        try
-        {
-            jLinkExec = getJLinkExecutable();
-        }
-        catch ( IOException e )
-        {
-            throw new MojoFailureException( "Unable to find jlink command: " + e.getMessage(), e );
-        }
+        String jLinkExec = getExecutable();
 
         getLog().info( "Toolchain in maven-jlink-plugin: jlink [ " + jLinkExec + " ]" );
 
         // TODO: Find a more better and cleaner way?
         File jLinkExecuteable = new File( jLinkExec );
 
-        // Really Hacky...do we have a better solution?
+        // Really Hacky...do we have a better solution to find the jmods directory of the JDK?
         File jLinkParent = jLinkExecuteable.getParentFile().getParentFile();
         File jmodsFolder = new File( jLinkParent, JMODS );
 
@@ -250,16 +241,22 @@ public class JLinkMojo
         List<Dependency> dependencies = getSession().getCurrentProject().getDependencies();
 
         List<MavenProject> modulesToAdd = new ArrayList<>();
+        if ( dependencies.isEmpty() )
+        {
+            
+        }
         getLog().info( "The following dependencies will be linked into the runtime image:" );
         for ( Dependency dependency : dependencies )
         {
             // We will support "jmod" as well as "jar"
+            // TODO: Think about jmod's cause they can contain config files etc. ? What todo with them?
             if ( JAR_PACKAGING.equals( dependency.getType() ) || JMOD_PACKAGING.equals( dependency.getType() ) )
             {
                 MavenProject mp = findDependencyInProjects( dependency );
                 getLog().info( " -> " + mp.getId() );
                 // TODO: What about module name != artifactId which has been
                 // defined in module-info.java file!
+                // This would mean to read the module-info information from the jmod file for example...
                 modulesToAdd.add( mp );
             }
         }
@@ -292,6 +289,21 @@ public class JLinkMojo
         getProject().getArtifact().setFile( createZipArchiveFromImage );
     }
 
+    private String getExecutable()
+        throws MojoFailureException
+    {
+        String jLinkExec;
+        try
+        {
+            jLinkExec = getJLinkExecutable();
+        }
+        catch ( IOException e )
+        {
+            throw new MojoFailureException( "Unable to find jlink command: " + e.getMessage(), e );
+        }
+        return jLinkExec;
+    }
+
     private boolean projectHasAlreadySetAnArtifact()
     {
         if ( getProject().getArtifact().getFile() != null )