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 2022/09/08 23:26:50 UTC
[maven-compiler-plugin] 02/02: [MCOMPILER-476] Simplify code for toolchains
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MCOMPILER-476
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
commit 29c834acdf1c2fb8a94d72d1a2b36ce8de4545ad
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Dec 19 14:32:41 2021 +0100
[MCOMPILER-476] Simplify code for toolchains
---
.../singleproject-toolchains/pom.xml | 2 +-
.../plugin/compiler/AbstractCompilerMojo.java | 31 ----------------------
2 files changed, 1 insertion(+), 32 deletions(-)
diff --git a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
index 154f8ae..39445bf 100644
--- a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
+++ b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
@@ -44,7 +44,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
+ <version>3.0.0</version>
<executions>
<execution>
<goals>
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 58d907d..8a14483 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -22,7 +22,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;
@@ -1602,43 +1601,13 @@ public abstract class AbstractCompilerMojo
return value;
}
- //TODO remove the part with ToolchainManager lookup once we depend on
- //3.0.9 (have it as prerequisite). Define as regular component field then.
protected final Toolchain getToolchain()
{
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.isEmpty() )
- {
- tc = tcs.get( 0 );
- }
- }
- catch ( NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException e )
- {
- // ignore
- }
- }
-
- if ( tc == null )
{
tc = toolchainManager.getToolchainFromBuildContext( "jdk", session );
}
-
return tc;
}