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/12/01 08:20:07 UTC

[maven-plugin-tools] branch bugfix/change-semantics-of-requiredJavaVersion created (now 907e6253)

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

kwin pushed a change to branch bugfix/change-semantics-of-requiredJavaVersion
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


      at 907e6253 [MNG-7611] Change semantics of plugin descriptor's "requiredJavaVersion"

This branch includes the following new commits:

     new 907e6253 [MNG-7611] Change semantics of plugin descriptor's "requiredJavaVersion"

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: [MNG-7611] Change semantics of plugin descriptor's "requiredJavaVersion"

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

kwin pushed a commit to branch bugfix/change-semantics-of-requiredJavaVersion
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit 907e6253aaa746655051c7a92ca5e21b67443c6d
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Dec 1 09:19:59 2022 +0100

    [MNG-7611] Change semantics of plugin descriptor's "requiredJavaVersion"
    
    Generate simple version constraints automatically
    Fix Javadoc
---
 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   | 8 ++++----
 .../java/org/apache/maven/tools/plugin/PluginToolsRequest.java    | 6 ++++--
 4 files changed, 10 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 51ba67d4..b3f34ed8 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 8d147efa..c3c4967c 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 1696335a..ba836830 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
@@ -252,9 +252,9 @@ public class DescriptorGeneratorMojo
      * Maven versions. Can be either one of the following formats:
      * 
      * <ul>
-     * <li>One of the values as for <a href="https://maven.apache.org/pom.html#Activation">POM profile activation
-     * element {@code jdk}</a>, i.e. version ranges, version prefixes
-     * and negated version prefixes (starting with '!').</li>
+     * <li>A version range which specifies the supported Java versions. It can either use the usual mathematical
+     * syntax like {@code "[2.0.10,2.1.0),[3.0,)"} or use a single version like {@code "2.2.1"}. The latter is a short
+     * form for {@code "[2.2.1,)"}, i.e. denotes the minimum version required.</li>
      * <li>{@code "auto"} to determine the minimum Java version from the binary class version being generated during
      * compilation (determined by the extractor).</li>
      * </ul>
@@ -456,7 +456,7 @@ public class DescriptorGeneratorMojo
             return null;
         }
         
-        return "[" + minRequiredJavaVersion + ",)";
+        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 a014ad3c..4e440f76 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,8 @@ public interface PluginToolsRequest
     
     /**
      * 
-     * @param requiredJavaVersion the minimally required java version for this plugin or {@code null} if unknown.
+     * @param requiredJavaVersion the required Java version for this plugin or {@code null} if unknown.
+     *  Must be a value according to semantics of {@link org.eclipse.aether.version.VersionConstraint}.
      * @return This request.
      * @since 3.8.0
      */
@@ -208,7 +209,8 @@ public interface PluginToolsRequest
 
     /**
      * 
-     * @return the minimally required java version for this plugin or {@code null} if unknown.
+     * @return the required Java version for this plugin or {@code null} if unknown.
+     *  Is a value according to semantics of {@link org.eclipse.aether.version.VersionConstraint}.
      * @since 3.8.0
      */
     String getRequiredJavaVersion();