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-jar-plugin.git
commit cf3527a429ab7bbafdb474b08fca87a2a9e51a0b Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Thu Nov 5 01:32:47 2026 +0000 Bind detectMultiReleaseJar through the user property, run the module descriptor tests on JDK 11 and newer --- .../org/apache/maven/plugins/jar/JarManifestTest.java | 16 +++++++++++++++- .../org/apache/maven/plugins/jar/JarModuleInfoTest.java | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/jar/JarManifestTest.java b/src/test/java/org/apache/maven/plugins/jar/JarManifestTest.java index 1b29a8f..4afb744 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarManifestTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarManifestTest.java @@ -21,6 +21,7 @@ package org.apache.maven.plugins.jar; import javax.inject.Inject; import java.io.IOException; +import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -39,12 +40,14 @@ import org.apache.maven.api.plugin.testing.MojoTest; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.DefaultArtifactHandler; +import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Organization; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.archiver.jar.ManifestException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.io.TempDir; import static org.apache.maven.plugins.jar.JarTestSupport.fileEntries; @@ -71,6 +74,9 @@ class JarManifestTest { @Inject private MavenProject project; + @Inject + private MavenSession session; + @TempDir private Path tmp; @@ -84,6 +90,14 @@ class JarManifestTest { classes = output.resolve("classes"); } + /** {@code -Dmaven.jar.detectMultiReleaseJar=false}, as the deleted MJAR-292 integration test passed it. */ + @BeforeEach + void disableDetectionOnTheCommandLine(TestInfo info) { + if (info.getTestMethod().map(Method::getName).orElse("").equals("multiReleaseDetectionCanBeDisabled")) { + session.getUserProperties().setProperty("maven.jar.detectMultiReleaseJar", "false"); + } + } + /** The harness replaces the project model when it creates the mojo, so the project is set up afterwards. */ private void initProject() throws IOException { JarTestSupport.initProject(project, tmp); @@ -268,7 +282,7 @@ class JarManifestTest { @Test @InjectMojo(goal = "jar", pom = FIXTURES + "main-class/plugin-config.xml") - @MojoParameter(name = "detectMultiReleaseJar", value = "false") + @MojoParameter(name = "detectMultiReleaseJar", value = "${maven.jar.detectMultiReleaseJar}") void multiReleaseDetectionCanBeDisabled(JarMojo mojo) throws Exception { initProject(); files( diff --git a/src/test/java/org/apache/maven/plugins/jar/JarModuleInfoTest.java b/src/test/java/org/apache/maven/plugins/jar/JarModuleInfoTest.java index 1452e1a..7d64d08 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarModuleInfoTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarModuleInfoTest.java @@ -59,10 +59,10 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; * {@code module-info.class}, and the entries of the descriptor are reproducible. * * <p>The descriptor is compiled from {@code src/test/resources/unit/module-info} by the test, so the tests need a - * JDK 9 or newer. + * JDK 11 or newer. */ @MojoTest -@EnabledForJreRange(min = JRE.JAVA_9) +@EnabledForJreRange(min = JRE.JAVA_11) class JarModuleInfoTest { private static final String FIXTURES = "src/test/resources/unit/";
