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

sjaranowski 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 110293f  [MCOMPILER-583] Require Maven 3.6.3
110293f is described below

commit 110293f730f03bd2361aafb39789055b52efe6ab
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Tue Mar 12 08:37:18 2024 +0100

    [MCOMPILER-583] Require Maven 3.6.3
---
 pom.xml                                            | 38 +++++++++++++++++-----
 .../plugin/compiler/AbstractCompilerMojo.java      | 26 +--------------
 2 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/pom.xml b/pom.xml
index 364c55a..8b45cb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <mavenVersion>3.2.5</mavenVersion>
+    <mavenVersion>3.6.3</mavenVersion>
     <plexusCompilerVersion>2.15.0</plexusCompilerVersion>
 
     <groovyVersion>2.4.21</groovyVersion>
@@ -127,6 +127,10 @@ under the License.
           <groupId>org.apache.maven.shared</groupId>
           <artifactId>maven-shared-utils</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-component-annotations</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 
@@ -160,14 +164,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>3.3.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- still needed because of AbstractMojoTestCase -->
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-compat</artifactId>
-      <version>${mavenVersion}</version>
+      <version>4.0.0-alpha-2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -218,6 +215,29 @@ under the License.
             </java>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-report-plugin</artifactId>
+          <configuration>
+            <requirementsHistories>
+              <requirementsHistory>
+                <version>from 3.13.0</version>
+                <maven>3.6.3</maven>
+                <jdk>8</jdk>
+              </requirementsHistory>
+              <requirementsHistory>
+                <version>from 3.9.0 to 3.12.1</version>
+                <maven>3.2.5</maven>
+                <jdk>8</jdk>
+              </requirementsHistory>
+              <requirementsHistory>
+                <version>from 3.0 to 3.8.1</version>
+                <maven>3.0</maven>
+                <jdk>7</jdk>
+              </requirementsHistory>
+            </requirementsHistories>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
 
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 78803f7..f9e7470 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -21,8 +21,6 @@ package org.apache.maven.plugin.compiler;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -1503,9 +1501,7 @@ public abstract class AbstractCompilerMojo extends 
AbstractMojo {
         Toolchain tc = null;
 
         if (jdkToolchain != null) {
-            // require Maven 3.3.1, that has plugin execution scoped Toolchain 
support: MNG-5755
-            List<Toolchain> tcs = getToolchains();
-
+            List<Toolchain> tcs = toolchainManager.getToolchains(session, 
"jdk", jdkToolchain);
             if (tcs != null && !tcs.isEmpty()) {
                 tc = tcs.get(0);
             }
@@ -1518,26 +1514,6 @@ public abstract class AbstractCompilerMojo extends 
AbstractMojo {
         return tc;
     }
 
-    // TODO use direct method invocation when prerequisite upgraded to Maven 
3.3.1
-    private List<Toolchain> getToolchains() {
-        try {
-            Method getToolchainsMethod =
-                    toolchainManager.getClass().getMethod("getToolchains", 
MavenSession.class, String.class, Map.class);
-
-            @SuppressWarnings("unchecked")
-            List<Toolchain> tcs =
-                    (List<Toolchain>) 
getToolchainsMethod.invoke(toolchainManager, session, "jdk", jdkToolchain);
-            return tcs;
-        } catch (NoSuchMethodException
-                | SecurityException
-                | IllegalAccessException
-                | IllegalArgumentException
-                | InvocationTargetException e) {
-            // ignore
-        }
-        return null;
-    }
-
     private boolean isDigits(String string) {
         for (int i = 0; i < string.length(); i++) {
             if (!Character.isDigit(string.charAt(i))) {

Reply via email to