Skip to content

[MCOMPILER-579] allow module-version configuration #273

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ under the License.
</parent>

<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.1-SNAPSHOT</version>
<version>3.14.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Compiler Plugin</name>
Expand Down Expand Up @@ -76,7 +76,7 @@ under the License.
<plexus-java.version>1.2.0</plexus-java.version>
<javaVersion>8</javaVersion>
<maven.it.failure.ignore>false</maven.it.failure.ignore>
<project.build.outputTimestamp>2024-03-15T07:28:09Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2025-02-13T18:15:32Z</project.build.outputTimestamp>
<invoker.junitPackageName>org.apache.maven.plugins.compiler.its</invoker.junitPackageName>
</properties>

Expand Down
12 changes: 11 additions & 1 deletion src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ public class CompilerMojo extends AbstractCompilerMojo {
@Parameter(defaultValue = "javac")
private String debugFileName;

/**
* The {@code --module-version} argument for the Java compiler.
* This is ignored if not applicable, e.g., in non-modular projects.
*
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-module-version">javac --module-version</a>
* @since 3.14.0
*/
@Parameter(property = "maven.compiler.moduleVersion", defaultValue = "${project.version}")
private String moduleVersion;

final LocationManager locationManager = new LocationManager();

private List<String> classpathElements;
Expand Down Expand Up @@ -302,7 +312,7 @@ protected void preparePaths(Set<File> sourceFiles) {
}

compilerArgs.add("--module-version");
compilerArgs.add(getProject().getVersion());
compilerArgs.add(moduleVersion);

} catch (IOException e) {
getLog().warn(e.getMessage());
Expand Down
Loading