Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MCOMPILER-583] Require Maven 3.6.3 #229

Merged
merged 1 commit into from Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 29 additions & 9 deletions pom.xml
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
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