You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2022/03/07 00:57:40 UTC

[maven-compiler-plugin] branch master updated: [MCOMPILER-426] add flag to enable-preview java compiler feature (#98)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6795b0f  [MCOMPILER-426] add flag to enable-preview java compiler feature (#98)
6795b0f is described below

commit 6795b0f508343dbc64dba384b85af2f1f3684b7a
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Mon Mar 7 10:57:34 2022 +1000

    [MCOMPILER-426] add flag to enable-preview java compiler feature (#98)
    
    * [MCOMPILER-426] add flag to enable-preview java compiler feature
    * use plexus-compiler 2.11.1 version
    
    Signed-off-by: Olivier Lamy <ol...@apache.org>
---
 pom.xml                                                        |  2 +-
 .../org/apache/maven/plugin/compiler/AbstractCompilerMojo.java | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b21709d..442fbd6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@ under the License.
       ! The following property is used in the integration tests MCOMPILER-157
     -->
     <mavenPluginPluginVersion>3.5</mavenPluginPluginVersion>
-    <plexusCompilerVersion>2.11.0</plexusCompilerVersion>
+    <plexusCompilerVersion>2.11.1</plexusCompilerVersion>
 
     <groovyVersion>2.4.21</groovyVersion>
     <groovyEclipseCompilerVersion>3.7.0</groovyEclipseCompilerVersion>
diff --git a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index 915d39f..e0ec1db 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -140,6 +140,14 @@ public abstract class AbstractCompilerMojo
     @Parameter( property = "maven.compiler.parameters", defaultValue = "false" )
     private boolean parameters;
 
+
+    /**
+     * Set to <code>true</code> to Enable preview language features of the java compiler
+     * @since 3.10.1
+     */
+    @Parameter( property = "maven.compiler.enablePreview", defaultValue = "false" )
+    private boolean enablePreview;
+
     /**
      * Set to <code>true</code> to show messages about what the compiler is doing.
      */
@@ -695,6 +703,8 @@ public abstract class AbstractCompilerMojo
 
         compilerConfiguration.setParameters( parameters );
 
+        compilerConfiguration.setEnablePreview( enablePreview );
+
         compilerConfiguration.setVerbose( verbose );
 
         compilerConfiguration.setShowWarnings( showWarnings );