Skip to content

Commit

Permalink
[MCOMPILER-583] Require Maven 3.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Mar 12, 2024
1 parent 90131df commit 110293f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 34 deletions.
38 changes: 29 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
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;
Expand Down Expand Up @@ -1503,9 +1501,7 @@ protected final Toolchain getToolchain() {
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);
}
Expand All @@ -1518,26 +1514,6 @@ protected final Toolchain getToolchain() {
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))) {
Expand Down

0 comments on commit 110293f

Please sign in to comment.