maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven-jlink-plugin] 11/38: Upgraded maven-archiver 3.2.0, plexus-archiver 3.5 Improved code.
Date Sat, 09 Dec 2017 15:27:37 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 144571b6e21ae5370e92fff69e486c9f6e2409b9
Author: Karl Heinz Marbaise <khmarbaise@apache.org>
AuthorDate: Thu Aug 17 19:38:52 2017 +0000

    Upgraded maven-archiver 3.2.0, plexus-archiver 3.5
    Improved code.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1805333 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  4 +--
 .../maven/plugins/jlink/AbstractJLinkMojo.java     |  1 +
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  | 36 ++++++++++++++--------
 3 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/pom.xml b/pom.xml
index b609c13..dc232fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
index 9efa97f..70f2860 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
@@ -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;
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 261ba3e..62334b9 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -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 )

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <commits@maven.apache.org>.

Mime
View raw message