You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2022/11/30 19:11:27 UTC

[maven-plugin-tools] branch bugfix/fix-auto-jdk-prequisite-in-descriptor created (now 66c25873)

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

kwin pushed a change to branch bugfix/fix-auto-jdk-prequisite-in-descriptor
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


      at 66c25873 [MPLUGIN-425] Generate version ranges for automatically detected minimal java version (derived from class version)

This branch includes the following new commits:

     new 66c25873 [MPLUGIN-425] Generate version ranges for automatically detected minimal java version (derived from class 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-plugin-tools] 01/01: [MPLUGIN-425] Generate version ranges for automatically detected minimal java version (derived from class version)

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

kwin pushed a commit to branch bugfix/fix-auto-jdk-prequisite-in-descriptor
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit 66c258738197c7a91cd2096bc5c08400d53f5763
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Nov 30 20:11:19 2022 +0100

    [MPLUGIN-425] Generate version ranges for automatically detected minimal
    java version (derived from class version)
---
 maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy  | 2 +-
 maven-plugin-plugin/src/it/v4api/verify.groovy                   | 2 +-
 .../org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java  | 9 +++++----
 .../java/org/apache/maven/tools/plugin/PluginToolsRequest.java   | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
index b3f34ed8..51ba67d4 100644
--- a/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
@@ -25,7 +25,7 @@ assert descriptorFile.isFile()
 
 def pluginDescriptor = new XmlParser().parse( descriptorFile );
 
-assert pluginDescriptor.requiredJavaVersion.text() == '1.8'
+assert pluginDescriptor.requiredJavaVersion.text() == '[1.8,)'
 assert pluginDescriptor.requiredMavenVersion.text() == '3.2.5'
 
 def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
diff --git a/maven-plugin-plugin/src/it/v4api/verify.groovy b/maven-plugin-plugin/src/it/v4api/verify.groovy
index c3c4967c..8d147efa 100644
--- a/maven-plugin-plugin/src/it/v4api/verify.groovy
+++ b/maven-plugin-plugin/src/it/v4api/verify.groovy
@@ -22,7 +22,7 @@ assert descriptorFile.isFile()
 
 def pluginDescriptor = new XmlParser().parse( descriptorFile );
 
-assert pluginDescriptor.requiredJavaVersion.text() == '1.8'
+assert pluginDescriptor.requiredJavaVersion.text() == '[1.8,)'
 assert pluginDescriptor.requiredMavenVersion.text() == '4.0.0-alpha-2'
 
 def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
index b50d8670..1696335a 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
@@ -448,14 +448,15 @@ public class DescriptorGeneratorMojo
         {
             return requiredJavaVersion;
         }
-        String requiredJavaVersion = request.getRequiredJavaVersion();
-        if ( requiredJavaVersion == null )
+        String minRequiredJavaVersion = request.getRequiredJavaVersion();
+        if ( minRequiredJavaVersion == null )
         {
-            getLog().warn( "Cannot determine the required Java version automatically, it is recommended to "
+            getLog().warn( "Cannot determine the minimally required Java version automatically, it is recommended to "
                             + "configure some explicit value manually." );
+            return null;
         }
         
-        return requiredJavaVersion;
+        return "[" + minRequiredJavaVersion + ",)";
     }
 
     /**
diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
index a0721e80..a014ad3c 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
@@ -200,7 +200,7 @@ public interface PluginToolsRequest
     
     /**
      * 
-     * @param requiredJavaVersion the required java version for this plugin or {@code null} if unknown.
+     * @param requiredJavaVersion the minimally required java version for this plugin or {@code null} if unknown.
      * @return This request.
      * @since 3.8.0
      */
@@ -208,7 +208,7 @@ public interface PluginToolsRequest
 
     /**
      * 
-     * @return the required java version for this plugin or {@code null} if unknown.
+     * @return the minimally required java version for this plugin or {@code null} if unknown.
      * @since 3.8.0
      */
     String getRequiredJavaVersion();