You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/01 19:08:40 UTC
(maven-jmod-plugin) branch master updated: Call ToolchainManager.getToolchains directly
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 5425767 Call ToolchainManager.getToolchains directly
5425767 is described below
commit 5425767a3dc262a86a4b0e6973641ab26354f357
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Oct 1 07:31:00 2026 +0200
Call ToolchainManager.getToolchains directly
---
.../maven/plugins/jmod/AbstractJModMojo.java | 29 +++-------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java b/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
index 09521ea..569956a 100644
--- a/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jmod/AbstractJModMojo.java
@@ -20,8 +20,6 @@ package org.apache.maven.plugins.jmod;
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
@@ -205,29 +203,10 @@ public abstract class AbstractJModMojo extends AbstractMojo {
Toolchain tc = null;
if (jdkToolchain != null) {
- // Maven 3.3.1 has plugin execution scoped Toolchain Support
- 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);
-
- if (tcs != null && tcs.size() > 0) {
- tc = tcs.get(0);
- }
- } catch (NoSuchMethodException e) {
- // ignore
- } catch (SecurityException e) {
- // ignore
- } catch (IllegalAccessException e) {
- // ignore
- } catch (IllegalArgumentException e) {
- // ignore
- } catch (InvocationTargetException e) {
- // ignore
+ List<Toolchain> tcs = toolchainManager.getToolchains(session, "jdk", jdkToolchain);
+
+ if (tcs != null && tcs.size() > 0) {
+ tc = tcs.get(0);
}
}