Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 553050 - Support maven.compiler.release
Support setting maven.compilere.release property.

Change-Id: Ibb6eb2f518d09c8b53f87b32941db4893622d4f3
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
  • Loading branch information
akurtakov committed Dec 2, 2019
1 parent 2df89d8 commit 9556b00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Expand Up @@ -234,6 +234,11 @@ public String[] buildCompilerArguments(CompilerConfiguration config, CustomCompi
args.add(config.getSourceVersion());
}

if (!StringUtils.isEmpty(config.getReleaseVersion())) {
args.add("--release");
args.add(config.getReleaseVersion());
}

if (!suppressEncoding(config) && !StringUtils.isEmpty(config.getSourceEncoding())) {
args.add("-encoding");
args.add(config.getSourceEncoding());
Expand Down
Expand Up @@ -114,6 +114,12 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
@Parameter(property = "maven.compiler.target")
protected String target;

/**
* The -release argument for the Java compiler
*/
@Parameter(property = "maven.compiler.release")
protected String release;

/**
* The -encoding argument for the Java compiler (kept for backwards compatibility)
*
Expand Down Expand Up @@ -455,6 +461,9 @@ protected CompilerConfiguration getCompilerConfiguration(List<String> compileSou
compilerConfiguration.setSourceVersion(source != null ? source : DEFAULT_SOURCE_VERSION);

compilerConfiguration.setTargetVersion(target != null ? target : DEFAULT_TARGET_VERSION);
if (release != null) {
compilerConfiguration.setReleaseVersion(release);
}

compilerConfiguration.setSourceEncoding(getEncoding());

Expand Down

0 comments on commit 9556b00

Please sign in to comment.