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 2018/08/07 19:59:01 UTC

[maven-compiler-plugin] branch MCOMPILER-322 created (now 2ba3f26)

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

rfscholte pushed a change to branch MCOMPILER-322
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git.


      at 2ba3f26  [MCOMPILER-322] Set the JPMS module version

This branch includes the following new commits:

     new 2ba3f26  [MCOMPILER-322] Set the JPMS module version

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-compiler-plugin] 01/01: [MCOMPILER-322] Set the JPMS module version

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MCOMPILER-322
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git

commit 2ba3f260c524c226dfd0e94fb22ab2b007519bb1
Author: rfscholte <rf...@apache.org>
AuthorDate: Tue Aug 7 21:58:55 2018 +0200

    [MCOMPILER-322] Set the JPMS module version
---
 src/it/MCOMPILER-268_modulepath/verify.groovy                    | 4 ++++
 src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/it/MCOMPILER-268_modulepath/verify.groovy b/src/it/MCOMPILER-268_modulepath/verify.groovy
index bef3790..5983712 100644
--- a/src/it/MCOMPILER-268_modulepath/verify.groovy
+++ b/src/it/MCOMPILER-268_modulepath/verify.groovy
@@ -19,3 +19,7 @@
 def log = new File( basedir, 'build.log').text
 
 assert log.count( " --module-path" ) == 2
+
+def descriptor = java.lang.module.ModuleFinder.of(basedir.toPath().resolve("target/classes")).find( "M.N" ).get().descriptor()
+assert '1.0-SNAPSHOT' == descriptor.version().get() as String
+assert 'M.N@1.0-SNAPSHOT' == descriptor.toNameAndVersion()
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index 04811c5..1d3eebf 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -305,6 +305,14 @@ public class CompilerMojo
                 {
                     modulepathElements.add( file.getPath() );
                 }
+                
+                if ( compilerArgs == null )
+                {
+                    compilerArgs = new ArrayList<String>();
+                }
+                compilerArgs.add( "--module-version" );
+                compilerArgs.add( getProject().getVersion() );
+                
             }
             catch ( IOException e )
             {