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-jlink-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new be19b13 Call ToolchainManager.getToolchains directly
be19b13 is described below
commit be19b133c246cd7b1bfaf0569edab9fc5aeb7fdb
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sat Nov 14 13:13:48 2026 +0100
Call ToolchainManager.getToolchains directly
---
.../maven/plugins/jlink/AbstractJLinkMojo.java | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git
a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
index e9146a8..f3bfdfb 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
@@ -38,7 +38,6 @@ package org.apache.maven.plugins.jlink;
*/
import java.io.File;
-import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -91,21 +90,10 @@ public abstract class AbstractJLinkMojo 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,
getSession(), "jdk", jdkToolchain);
-
- if (tcs != null && tcs.size() > 0) {
- tc = tcs.get(0);
- }
- } catch (ReflectiveOperationException | SecurityException |
IllegalArgumentException e) {
- // ignore
+ List<Toolchain> tcs = toolchainManager.getToolchains(getSession(),
"jdk", jdkToolchain);
+
+ if (tcs != null && tcs.size() > 0) {
+ tc = tcs.get(0);
}
}