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/06/26 17:42:02 UTC

svn commit: r1799962 - in /maven/plugins/trunk/maven-jmod-plugin/src/main: filtered-resources/META-INF/plexus/ java/org/apache/maven/plugins/jmod/

Author: khmarbaise
Date: Mon Jun 26 17:42:02 2017
New Revision: 1799962

URL: http://svn.apache.org/viewvc?rev=1799962&view=rev
Log:
Improved Plugin
 o Adding now the artifact as main artifact.
 o Fixed some issues related to Upgrade to JDK9 EA+175

Modified:
    maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.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
    maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModHashMojo.java

Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml?rev=1799962&r1=1799961&r2=1799962&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml (original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml Mon Jun 26 17:42:02 2017
@@ -38,7 +38,7 @@
 
     <!--
       | Defining the phases with their appropriate plugins
-      ! and versions which will be executed during the 'default'
+      ! and versions which will be executed during the 'jlink'
       ! life cycle.
     -->
     <!--

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=1799962&r1=1799961&r2=1799962&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 Mon Jun 26 17:42:02 2017
@@ -146,6 +146,18 @@ public abstract class AbstractJModMojo
         return jLinkExe.getAbsolutePath();
     }
     
+    protected boolean projectHasAlreadySetAnArtifact()
+    {
+        if ( getProject().getArtifact().getFile() != null )
+        {
+            return getProject().getArtifact().getFile().isFile();
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
     protected void executeCommand ( Commandline cmd, File outputDirectory ) throws MojoExecutionException
     {
         if ( getLog().isDebugEnabled() )

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=1799962&r1=1799961&r2=1799962&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 Mon Jun 26 17:42:02 2017
@@ -49,19 +49,21 @@ public class JModCreateMojo
 {
 
     /**
-     * <code>--class-path &lt;path&gt;</code> Application jar files|dir containing classes.
+     * <code>--class-path &lt;path&gt;</code> Application jar files/directory containing classes.
      */
     @Parameter( defaultValue = "${project.build.outputDirectory}" )
     private List<String> classPath;
 
     /**
-     * <code>--class-path &lt;path&gt;</code> Application jar files|dir containing classes.
+     * Location of native commands
      */
     @Parameter
     private List<String> cmds;
 
     /**
      * <code>--config &lt;path&gt;</code> Location of user-editable config files.
+     * TODO: Implement the handling. Should we use src/main/resources for this?
+     * or better something different? What about filtering?
      */
     @Parameter
     private File config;
@@ -72,8 +74,11 @@ public class JModCreateMojo
     @Parameter
     private String mainClass;
 
+    /**
+     * Location of native libraries. <code>--libs &lt;path&gt;</code>
+     */
     @Parameter
-    private List<File> libs;
+    private File libs;
 
     @Parameter( defaultValue = "${project.version}" )
     private String moduleVersion;
@@ -85,6 +90,9 @@ public class JModCreateMojo
     @Parameter( defaultValue = "${project.build.outputDirectory}", required = true )
     private File modulePath;
 
+    /**
+     * The moduleName. The default is to use the <code>artifactId</code>.
+     */
     @Parameter( defaultValue = "${project.artifactId}", required = true )
     private String moduleName;
 
@@ -124,6 +132,13 @@ public class JModCreateMojo
 
         executeCommand( cmd, outputDirectory );
 
+        if ( projectHasAlreadySetAnArtifact() )
+        {
+            throw new MojoExecutionException( "You have to use a classifier "
+                + "to attach supplemental artifacts to the project instead of replacing them." );
+        }
+
+        getProject().getArtifact().setFile( resultingJModFile );
     }
 
     private void deleteOutputIfAlreadyExists( File resultingJModFile )
@@ -182,6 +197,12 @@ public class JModCreateMojo
             cmd.createArg().setValue( sb.toString() );
         }
 
+        if ( config != null )
+        {
+            cmd.createArg().setValue( "--config" );
+            cmd.createArg().setFile( config );
+        }
+
         // Can not be overwritten...
         // TODO: Good idea?
         cmd.createArg().setFile( resultingJModFile );

Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModHashMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModHashMojo.java?rev=1799962&r1=1799961&r2=1799962&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModHashMojo.java (original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModHashMojo.java Mon Jun 26 17:42:02 2017
@@ -33,7 +33,7 @@ import org.codehaus.plexus.util.cli.Comm
 
 /**
  * <pre>
- * jmod create ...
+ * jmod hash ...
  * </pre>
  * 
  * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>