maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject svn commit: r1807049 - in /maven/plugins/trunk/maven-jlink-plugin: ./ src/main/java/org/apache/maven/plugins/jlink/ src/site/ src/site/apt/ src/site/resources/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apac...
Date Sat, 02 Sep 2017 14:34:36 GMT
Author: khmarbaise
Date: Sat Sep  2 14:34:35 2017
New Revision: 1807049

URL: http://svn.apache.org/viewvc?rev=1807049&view=rev
Log:
Added basic site information.
Addded parameter documentation.
Added some unit tests for methods in AbstractJLinkMojo

Added:
    maven/plugins/trunk/maven-jlink-plugin/src/site/
    maven/plugins/trunk/maven-jlink-plugin/src/site/apt/
    maven/plugins/trunk/maven-jlink-plugin/src/site/apt/index.apt.vm
    maven/plugins/trunk/maven-jlink-plugin/src/site/apt/usage.apt.vm
    maven/plugins/trunk/maven-jlink-plugin/src/site/resources/
    maven/plugins/trunk/maven-jlink-plugin/src/site/resources/download.cgi
    maven/plugins/trunk/maven-jlink-plugin/src/site/site.xml
    maven/plugins/trunk/maven-jlink-plugin/src/test/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/
    maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/AbsractJLinkMojoTest.java
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=1807049&r1=1807048&r2=1807049&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-jlink-plugin/pom.xml Sat Sep  2 14:34:35 2017
@@ -118,6 +118,18 @@
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>1.10.19</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>1.7.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

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=1807049&r1=1807048&r2=1807049&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
Sat Sep  2 14:34:35 2017
@@ -77,7 +77,7 @@ public abstract class AbstractJLinkMojo
             jLinkExecutable = tc.findTool( "jlink" );
         }
 
-        //TODO: Check if there exist a more elegant way?
+        // TODO: Check if there exist a more elegant way?
         String jLinkCommand = "jlink" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" );
 
         File jLinkExe;
@@ -121,8 +121,8 @@ public abstract class AbstractJLinkMojo
             {
                 throw new IOException( "The environment variable JAVA_HOME is not correctly
set." );
             }
-            if ( ( !new File( javaHome ).getCanonicalFile().exists() )
-                || ( new File( javaHome ).getCanonicalFile().isFile() ) )
+            if ( !new File( javaHome ).getCanonicalFile().exists()
+                || new File( javaHome ).getCanonicalFile().isFile() )
             {
                 throw new IOException( "The environment variable JAVA_HOME=" + javaHome
                     + " doesn't exist or is not a valid directory." );
@@ -257,6 +257,7 @@ public abstract class AbstractJLinkMojo
      * @param basedir the output directory
      * @param finalName the name of the ear file
      * @param classifier an optional classifier
+     * @param archiveExt The extension of the file.
      * @return the file to generate
      */
     protected File getArchiveFile( File basedir, String finalName, String classifier, String
archiveExt )
@@ -307,4 +308,67 @@ public abstract class AbstractJLinkMojo
         return result;
     }
 
+    /**
+     * This will convert a module path separated by either {@code :} or {@code ;} into a
string which uses the platform
+     * depend path separator uniformly.
+     * 
+     * @param pluginModulePath The module path.
+     * @return The platform separated module path.
+     */
+    protected StringBuilder convertSeparatedModulePathToPlatformSeparatedModulePath( String
pluginModulePath )
+    {
+        StringBuilder sb = new StringBuilder();
+        // Split the module path by either ":" or ";" linux/windows path separator and
+        // convert uniformly to the platform used separator.
+        String[] splitModule = pluginModulePath.split( "[;:]" );
+        for ( String module : splitModule )
+        {
+            if ( sb.length() > 0 )
+            {
+                sb.append( File.pathSeparatorChar );
+            }
+            sb.append( module );
+        }
+        return sb;
+    }
+
+    /**
+     * Convert a list into a string which is separated by platform depend path separator.
+     * 
+     * @param modulePaths The list of elements.
+     * @return The string which contains the elements separated by {@link File#pathSeparatorChar}.
+     */
+    protected String getPlatformDependSeparateList( List<String> modulePaths )
+    {
+        StringBuilder sb = new StringBuilder();
+        for ( String module : modulePaths )
+        {
+            if ( sb.length() > 0 )
+            {
+                sb.append( File.pathSeparatorChar );
+            }
+            sb.append( module );
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Convert a list into a 
+     * @param modules The list of modules.
+     * @return The string with the module list which is separated by {@code ,}.
+     */
+    protected String getCommaSeparatedList( List<String> modules )
+    {
+        StringBuilder sb = new StringBuilder();
+        for ( String module : modules )
+        {
+            if ( sb.length() > 0 )
+            {
+                sb.append( ',' );
+            }
+            sb.append( module );
+        }
+        return sb.toString();
+    }
+
 }

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=1807049&r1=1807048&r2=1807049&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
Sat Sep  2 14:34:35 2017
@@ -34,10 +34,8 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectHelper;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.archiver.zip.ZipArchiver;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.cli.Commandline;
@@ -84,9 +82,7 @@ import org.codehaus.plexus.util.cli.Comm
  * 
  * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
  */
-// TODO: Think if ResultionScope is needed here? May be we need to reconsider package phase?
-// May be it would be wise to put into PREPARE-PACKAGE and the generation of the final jimage
in the package phase?
-// Furthermore It could make sense so we can change the conf files if needed...
+// TODO: Check things about conf files?
 // CHECKSTYLE_OFF: LineLength
 @Mojo( name = "jlink", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true )
 // CHECKSTYLE_ON: LineLength
@@ -100,53 +96,83 @@ public class JLinkMojo
     private static final String JAR_PACKAGING = "jar";
 
     /**
+     * This is intended to strip debug information out. The command line equivalent of <code>jlink</code>
is:
      * <code>-G, --strip-debug</code> strip debug information.
      */
     @Parameter( defaultValue = "false" )
     private boolean stripDebug;
 
     /**
-     * <code>-c, --compress=&lt;0|1|2&gt;</code> Enabled compression
of resources.
+     * Here you can define the compression of the resources being used. The command line
equivalent is:
+     * <code>-c, --compress=&lt;0|1|2&gt;</code>.
      */
     @Parameter
     private Integer compression;
 
     /**
-     * Limit the universe of observable modules. <code>--limit-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>
+     * Limit the universe of observable modules. The following gives an example of the configuration
which can be used
+     * in the <code>pom.xml</code> file.
+     * 
+     * <pre>
+     *   &lt;limitModules&gt;
+     *     &lt;limitModule&gt;mod1&lt;/limitModule&gt;
+     *     &lt;limitModule&gt;xyz&lt;/limitModule&gt;
+     *     .
+     *     .
+     *   &lt;/limitModules&gt;
+     * </pre>
+     * 
+     * This configuration is the equivalent of the command line option:
+     * <code>--limit-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>
      */
     @Parameter
     private List<String> limitModules;
 
     /**
-     * Root modules to resolve. <code>--add-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>
+     * By using the --add-modules you can define the root modules to be resolved. The configuration
in
+     * <code>pom.xml</code> file can look like this:
+     * 
+     * <pre>
+     * &lt;addModules&gt;
+     *   &lt;addModule&gt;mod1&lt;/addModule&gt;
+     *   &lt;addModule&gt;first&lt;/addModule&gt;
+     *   .
+     *   .
+     * &lt;/addModules&gt;
+     * </pre>
+     * 
+     * The command line equivalent for jlink is: <code>--add-modules &lt;mod&gt;[,&lt;mod&gt;...]</code>.
      */
     @Parameter
     private List<String> addModules;
 
     /**
-     * Custom plugin module path <code>--plugin-module-path &lt;modulepath&gt;</code>
+     * Define the plugin module path to be used. There can be defined multiple entries separated
by either {@code ;} or
+     * {@code :}. The jlink command line equivalent is: <code>--plugin-module-path
&lt;modulepath&gt;</code>
      */
     @Parameter
-    private File pluginModulePath;
+    private String pluginModulePath;
 
     /**
+     * The output directory for the resulting Run Time Image. This is stored in non compressed
form.
      * <code>--output &lt;path&gt;</code>
-     * </p>
      */
     // TODO: is this a good final location?
     @Parameter( defaultValue = "${project.build.directory}/jlink" )
     private File outputDirectoryImage;
 
-    @Parameter( defaultValue = "${project.build.directory}" )
+    @Parameter( defaultValue = "${project.build.directory}", required = true, readonly =
true )
     private File outputDirectory;
 
     /**
-     * Byte order of generated jimage (default:native). <code>--endian &lt;little|big&gt;</code>.
-     * </p>
+     * The byte order of the generated Java Run Time image. <code>--endian &lt;little|big&gt;</code>.
If the endian is
+     * not given the default is: <code>native</code>.
      */
-    @Parameter( defaultValue = "native" )
+    // TODO: Should we define either little or big as default? or should we left as it.
+    @Parameter
     private String endian;
 
+    // TODO: Check if we should allow to extend the modulePaths by manual additions in the
pom file?
     @Parameter( defaultValue = "${project.compileClasspathElements}", readonly = true, required
= true )
     private List<String> modulePaths;
 
@@ -157,7 +183,7 @@ public class JLinkMojo
     private boolean bindServices;
 
     /**
-     * --disable-plugin pluginName.
+     * You can disable a plugin by using this option. <code>--disable-plugin pluginName</code>.
      */
     @Parameter
     private String disablePlugin;
@@ -181,13 +207,24 @@ public class JLinkMojo
     private boolean noManPages;
 
     /**
-     * --suggest-providers [<name>,...] Suggest providers that implement the given
service types from the module path
+     * Suggest providers that implement the given service types from the module path.
+     * 
+     * <pre>
+     * &lt;suggestProviders&gt;
+     *   &lt;suggestProvider&gt;name-a&lt;/suggestProvider&gt;
+     *   &lt;suggestProvider&gt;name-b&lt;/suggestProvider&gt;
+     *   .
+     *   .
+     * &lt;/suggestProviders&gt;
+     * </pre>
+     * 
+     * The jlink command linke equivalent: <code>--suggest-providers [&lt;name&gt;,...]</code>
      */
     @Parameter
     private List<String> suggestProviders;
 
     /**
-     * <code>--verbose</code>
+     * This will turn on verbose mode. The jlink command line equivalent is: <code>--verbose</code>
      */
     @Parameter( defaultValue = "false" )
     private boolean verbose;
@@ -198,20 +235,8 @@ public class JLinkMojo
     @Component( role = Archiver.class, hint = "zip" )
     private ZipArchiver zipArchiver;
 
-    @Component
-    private ArchiverManager manager;
-
     /**
-     * The kind of archive we will produce.
-     */
-    @Parameter( defaultValue = "zip", required = true )
-    private String archiveType;
-
-    @Component
-    private MavenProjectHelper projectHelper;
-
-    /**
-     * Name of the generated JAR.
+     * Name of the generated ZIP file.
      */
     @Parameter( defaultValue = "${project.build.finalName}", readonly = true )
     private String finalName;
@@ -241,22 +266,25 @@ public class JLinkMojo
         List<Dependency> dependencies = getSession().getCurrentProject().getDependencies();
 
         List<MavenProject> modulesToAdd = new ArrayList<>();
-        if ( dependencies.isEmpty() )
-        {
-            
-        }
+//        if ( dependencies.isEmpty() )
+//        {
+//            // Do we need to do something if no dependencies have been defined ?
+//            // WARNING ?
+//        }
         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?
+            // TODO: Think about jmod's cause they can contain config files etc. ? What todo
with them? Are they already
+            // handled by jlink ? 
             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...
+                // This would mean to read the module-info information from the jmod/jar
file for example to 
+                // get the appropriate information.
                 modulesToAdd.add( mp );
             }
         }
@@ -350,11 +378,11 @@ public class JLinkMojo
             addModules = new ArrayList<>();
         }
 
-        for ( MavenProject mavenProject : modulesToAdd )
+        for ( MavenProject module : modulesToAdd )
         {
             // TODO: Check if this is the correct way?
-            // This implies the artifactId is equal to moduleName.
-            addModules.add( mavenProject.getArtifactId() );
+            // This implies the artifactId is equal to moduleName which might not always
be the case!
+            addModules.add( module.getArtifactId() );
         }
     }
 
@@ -406,6 +434,14 @@ public class JLinkMojo
             throw new MojoFailureException( message );
         }
 
+        if ( endian != null && ( !"big".equals( endian ) || !"little".equals( endian
) ) )
+        {
+            String message =
+                "The given endian parameters " + endian + " is not in the valid value either
'little' or 'big'.";
+            getLog().error( message );
+            throw new MojoFailureException( message );
+        }
+
         // CHECK if this assumption here is correct?
         // if ( modulePaths != null && ( !modulePaths.isEmpty() ) )
         // {
@@ -463,6 +499,11 @@ public class JLinkMojo
             argsFile.println( "--bind-services" );
         }
 
+        if ( endian != null )
+        {
+            argsFile.println( "--bind-services" );
+            argsFile.println( endian );
+        }
         if ( ignoreSigningInformation )
         {
             argsFile.println( "--ignore-signing-information" );
@@ -481,8 +522,14 @@ public class JLinkMojo
         }
         if ( modulePaths != null )
         {
+            //@formatter:off
             argsFile.println( "--module-path" );
-            argsFile.append( '"' ).append( getColonSeparateList( modulePaths ).replace( "\\",
"\\\\" ) ).println( '"' );
+            argsFile
+              .append( '"' )
+              .append( getPlatformDependSeparateList( modulePaths )
+                         .replace( "\\", "\\\\" ) 
+                     ).println( '"' );
+            //@formatter:off
         }
 
         if ( noHeaderFiles )
@@ -498,24 +545,31 @@ public class JLinkMojo
         if ( hasSuggestProviders() )
         {
             argsFile.println( "--suggest-providers" );
-            StringBuilder sb = getCommaSeparatedList( suggestProviders );
-            argsFile.println( sb.toString() );
+            String sb = getCommaSeparatedList( suggestProviders );
+            argsFile.println( sb );
         }
 
         if ( hasLimitModules() )
         {
             argsFile.println( "--limit-modules" );
-            StringBuilder sb = getCommaSeparatedList( limitModules );
-            argsFile.println( sb.toString() );
+            String sb = getCommaSeparatedList( limitModules );
+            argsFile.println( sb );
         }
 
         if ( hasModules() )
         {
             argsFile.println( "--add-modules" );
             // This must be name of the module and *NOT* the name of the
-            // file!
-            StringBuilder sb = getCommaSeparatedList( addModules );
-            argsFile.println( sb.toString() );
+            // file! Can we somehow pre check this information to fail early?
+            String sb = getCommaSeparatedList( addModules );
+            argsFile.append( '"' ).append( sb.replace( "\\", "\\\\" ) ).println( '"' );
+        }
+
+        if ( pluginModulePath != null )
+        {
+            argsFile.println( "--plugin-module-path" );
+            StringBuilder sb = convertSeparatedModulePathToPlatformSeparatedModulePath( pluginModulePath
);
+            argsFile.append( '"' ).append( sb.toString().replace( "\\", "\\\\" ) ).println(
'"' );
         }
 
         if ( outputDirectory != null )
@@ -550,32 +604,4 @@ public class JLinkMojo
     {
         return addModules != null && !addModules.isEmpty();
     }
-
-    private String getColonSeparateList( List<String> modulePaths )
-    {
-        StringBuilder sb = new StringBuilder();
-        for ( String module : modulePaths )
-        {
-            if ( sb.length() > 0 )
-            {
-                sb.append( File.pathSeparator );
-            }
-            sb.append( module );
-        }
-        return sb.toString();
-    }
-
-    private StringBuilder getCommaSeparatedList( List<String> modules )
-    {
-        StringBuilder sb = new StringBuilder();
-        for ( String module : modules )
-        {
-            if ( sb.length() > 0 )
-            {
-                sb.append( ',' );
-            }
-            sb.append( module );
-        }
-        return sb;
-    }
 }

Added: maven/plugins/trunk/maven-jlink-plugin/src/site/apt/index.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/site/apt/index.apt.vm?rev=1807049&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/site/apt/index.apt.vm (added)
+++ maven/plugins/trunk/maven-jlink-plugin/src/site/apt/index.apt.vm Sat Sep  2 14:34:35 2017
@@ -0,0 +1,72 @@
+  ------
+  Introduction
+  ------
+  Karl Heinz Marbaise
+  ------
+  2017-08-17
+  ------
+
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+${project.name}
+
+  The JLink Plugin is intended to create a {{{http://openjdk.java.net/jeps/220}Modular Run-Time
Images}}
+  via {{{http://openjdk.java.net/jeps/282}jlink}}.
+    
+  NOTE: This is an alpha release which means everything can change until we reach the first
+  milestone release.
+
+* Goals Overview
+
+  The JLink Plugin has two goals:
+
+  * {{{./jlink-mojo.html}jlink:jlink}} ....
+
+  * {{{./help-mojo.html}jlink:help}} displays help information on maven-jlink-plugin.
+
+  []
+
+* Usage
+
+  General instructions on how to use the JLink Plugin can be found on the {{{./usage.html}usage
page}}. Some more
+  specific use cases are described in the examples given below.
+
+  In case you still have questions regarding the plugin's usage, please have a look at the
{{{./faq.html}FAQ}} and feel
+  free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing
list are archived and could
+  already contain the answer to your question as part of an older thread. Hence, it is also
worth browsing/searching
+  the {{{./mail-lists.html}mail archive}}.
+
+  If you feel like the plugin is missing a feature or has a defect, you can fill a feature
request or bug report in our
+  {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive
description of your
+  concern. Especially for fixing bugs it is crucial that the developers can reproduce your
problem. For this reason,
+  entire debug logs, POMs or most preferably little demo projects attached to the issue are
very much appreciated.
+  Of course, patches are welcome, too. Contributors can check out the project from our
+  {{{./source-repository.html}source repository}} and will find supplementary information
in the
+  {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with
Maven}}.
+
+* Examples
+
+  To provide you with better understanding on some usages of the Maven JLink Plugin,
+  you can take a look into the following examples:
+
+  TODO: Add examples.
+
+  []

Added: maven/plugins/trunk/maven-jlink-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/site/apt/usage.apt.vm?rev=1807049&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/site/apt/usage.apt.vm (added)
+++ maven/plugins/trunk/maven-jlink-plugin/src/site/apt/usage.apt.vm Sat Sep  2 14:34:35 2017
@@ -0,0 +1,58 @@
+  ------
+  Usage
+  ------
+  Karl Heinz Marbaise <khmarbaise@apache.org>
+  ------
+  2017-09-01
+
+~~ Copyright 2006 The Apache Software Foundation.
+~~
+~~ Licensed under the Apache License, Version 2.0 (the "License");
+~~ you may not use this file except in compliance with the License.
+~~ You may obtain a copy of the License at
+~~
+~~      http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+
+Usage
+
+* Introduction
+
+  The Maven JLink Pluing will be used to create a Java Run-Time Image.
+  
+* Configuring the JLink Plugin
+
+  The configuration of the JLink Plugin is a bit different from the configuration
+  of any other plugin. The configuration should look like this:
+
++-----
+<project>
+  [...]
+  <build>
+    [...]
+    <plugins>
+      [...]
+      <plugin>
+        <artifactId>maven-jlink-plugin</artifactId>
+        <version>${project.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <!-- configuration elements goes here -->
+        </configuration>
+      </plugin>
+   [...]
+</project>
++-----
+
+  The configuration elements contains the configuration for the plugin like
+  other Maven plugins.
+  

Added: maven/plugins/trunk/maven-jlink-plugin/src/site/resources/download.cgi
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/site/resources/download.cgi?rev=1807049&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/site/resources/download.cgi (added)
+++ maven/plugins/trunk/maven-jlink-plugin/src/site/resources/download.cgi Sat Sep  2 14:34:35
2017
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Just call the standard mirrors.cgi script. It will use download.html
+# as the input template.
+exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $*
\ No newline at end of file

Added: maven/plugins/trunk/maven-jlink-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/site/site.xml?rev=1807049&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/site/site.xml (added)
+++ maven/plugins/trunk/maven-jlink-plugin/src/site/site.xml Sat Sep  2 14:34:35 2017
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"
+>
+  <custom>
+    <fluidoSkin>
+      <profile>pre-release</profile>
+    </fluidoSkin>
+  </custom>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html" />
+      <item name="Goals" href="plugin-info.html" />
+      <item name="Usage" href="usage.html" />
+      <!-- <item name="FAQ" href="faq.html"/> -->
+      <!-- According to https://issues.apache.org/jira/browse/MNGSITE-152 -->
+      <item name="License" href="http://www.apache.org/licenses/" />
+      <item name="Download" href="download.html" />
+    </menu>
+    <!-- <menu name="Examples"> -->
+    <!-- <item name="Basic multi module setup" href="examples/base-jlink-example.html"/>
-->
+    <!-- </menu> -->
+  </body>
+</project>

Added: maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/AbsractJLinkMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/AbsractJLinkMojoTest.java?rev=1807049&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/AbsractJLinkMojoTest.java
(added)
+++ maven/plugins/trunk/maven-jlink-plugin/src/test/java/org/apache/maven/plugins/jlink/AbsractJLinkMojoTest.java
Sat Sep  2 14:34:35 2017
@@ -0,0 +1,109 @@
+package org.apache.maven.plugins.jlink;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+/**
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ */
+public class AbsractJLinkMojoTest
+{
+    private AbstractJLinkMojo mojoMock;
+
+    @Before
+    public void before()
+    {
+        this.mojoMock = mock( AbstractJLinkMojo.class, Mockito.CALLS_REAL_METHODS );
+    }
+
+    @Test
+    public void convertShouldReturnSingleCharacter()
+    {
+        StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath(
"x" );
+        assertThat( result.toString() ).isNotEmpty().isEqualTo( "x" );
+    }
+
+    @Test
+    public void convertShouldReturnTwoCharactersSeparatedByPathSeparator()
+    {
+        StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath(
"x;a" );
+        assertThat( result.toString() ).isEqualTo( "x" + File.pathSeparatorChar + "a" );
+    }
+
+    @Test
+    public void convertUsingDifferentDelimiterShouldReturnTwoCharactersSeparatedByPathSeparator()
+    {
+        StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath(
"x:a" );
+        assertThat( result.toString() ).isEqualTo( "x" + File.pathSeparatorChar + "a" );
+    }
+
+    @Test
+    public void convertUsingMultipleDelimitersShouldReturnTwoCharactersSeparatedByPathSeparator()
+    {
+        StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath(
"x:a::" );
+        assertThat( result.toString() ).isEqualTo( "x" + File.pathSeparatorChar + "a" );
+    }
+
+    @Test
+    public void getPlatformDependSeparateListShouldReturnASingleCharacter()
+    {
+        String result = mojoMock.getPlatformDependSeparateList( Collections.singletonList(
"A" ) );
+        assertThat( result ).isEqualTo( "A" );
+    }
+
+    @Test
+    public void getPlatformDependSeparateListShouldReturnTwoCharactersSeparated()
+    {
+        String result = mojoMock.getPlatformDependSeparateList( Arrays.asList( "A", "B" )
);
+        assertThat( result ).isEqualTo( "A" + File.pathSeparatorChar + "B" );
+    }
+
+    @Test
+    public void getPlatformDependSeparateListShouldReturnThreeCharactersSeparated()
+    {
+        String result = mojoMock.getPlatformDependSeparateList( Arrays.asList( "A", "B",
"C" ) );
+        assertThat( result ).isEqualTo( "A" + File.pathSeparatorChar + "B" + File.pathSeparatorChar
+ "C" );
+    }
+
+    @Test
+    public void getCommaSeparatedListShouldReturnASingleCharacter()
+    {
+        String result = mojoMock.getCommaSeparatedList( Arrays.asList( "A" ) );
+        assertThat( result ).isEqualTo( "A" );
+    }
+
+    @Test
+    public void getCommaSeparatedListShouldReturnTwoCharactersSeparatedByComma()
+    {
+        String result = mojoMock.getCommaSeparatedList( Arrays.asList( "A", "B" ) );
+        assertThat( result ).isEqualTo( "A,B" );
+    }
+
+}



Mime
View raw message