You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (Jira)" <ji...@apache.org> on 2022/02/03 11:56:00 UTC

[jira] [Commented] (MCOMPILER-468) Introduce parameter to be used for source, target and release

    [ https://issues.apache.org/jira/browse/MCOMPILER-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17486413#comment-17486413 ] 

Olivier Lamy commented on MCOMPILER-468:
----------------------------------------

simply use different profile activated by jdk version

> Introduce parameter to be used for source, target and release
> -------------------------------------------------------------
>
>                 Key: MCOMPILER-468
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-468
>             Project: Maven Compiler Plugin
>          Issue Type: Improvement
>    Affects Versions: 3.8.1
>            Reporter: Konrad Windszus
>            Priority: Major
>
> Setting up the maven-compiler-plugin in a way that is compatible with both JDK < 9 and JDK 9+ is tricky as
> # parameter {{release}} breaks compilation with javac 8 or older (https://github.com/codehaus-plexus/plexus-compiler/issues/140)
> # {{source}}, {{target}} and {{release}} accept different values: JDK <= 8 only supports values starting with {{1.}} while JDK 9+ accepts only {{6}}, {{7}}, {{8}}, {{9}}, ... for {{release}} and in addition also {{1.6}}, {{1.7}} and {{1.8}} for {{source}} and {{target}}.
> I propose to introduce a new parameter which hides that complexity called {{targetJavaVersion}} or similar accepting both {{1.6}}, {{1.7}} and {{1.8}} and {{6}}, {{7}}, {{8}}, {{9}}, ... and use that value (transformed accordingly) either with {{release}} for JDK9 + or with {{source}} and {{target}} for JDK < 9.
> ECJ allows passing other values to {{release}} (https://help.eclipse.org/2021-06/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_batch_compiler.htm)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)