You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Marwell (Jira)" <ji...@apache.org> on 2023/10/23 11:00:00 UTC

[jira] [Resolved] (MCOMPILER-550) Make 'outputDirectory' writable

     [ https://issues.apache.org/jira/browse/MCOMPILER-550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Marwell resolved MCOMPILER-550.
----------------------------------------
    Resolution: Fixed

Fixed in https://github.com/apache/maven-compiler-plugin/commit/c459d1d2738a78e387e2f67ee86626bc5fc55a7c

> Make 'outputDirectory' writable
> -------------------------------
>
>                 Key: MCOMPILER-550
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-550
>             Project: Maven Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Benjamin Marwell
>            Assignee: Benjamin Marwell
>            Priority: Major
>             Fix For: 3.12.0
>
>
> h2. Description of Improvement
> Currently, the property 'outputDirectory' is not writable, i.e. not meant to be modified.
> However, making it writable  has at least two major advantages.
> h2. Use case one -- variable is already used
> Some Tutorials (e.g. https://www.baeldung.com/maven-multi-release-jars) already make use of rewriting the variable.
> h2. Use case two: MR-Jars with different bytecode level.
> Another use case is Multi-Release-Jars. Currently, they can officially only be controlled by setting the {{release}} property. That will not only require a suitable JDK or Toolchain-JDK, it will also require the bytecode for that version to be the bytecode of that version.
> E.g. using {{release}} and {{multiReleaseOutput}}, the bytecode in {{META-INF/version/java9}} MUST be exactly Java 9 bytecode.
> However, the JDK does not know of such restrictions.
> Using {{outputDirectory}}, you can now create Java 8 bytecode to run in e.g. Java 24. Here is an example use case: https://github.com/groovy/GMavenPlus/pull/287
> Granted, this could also be done differently, but this way it seems a little more elegant.
> The actual advantage is, that some developers can now plan ahead. For example, the SecurityManager is not just deprecated, it is deprecated for removal. The moment we know which Java version it is, we can create a MR-Jar for e.g. Java 30, even though Java 30 SDKs are not available then (currently we have Java 21 GA).
> h2. Proposed solution
> Make variable writable as suggested in Slack.
> PR available locally.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)