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

Slawomir Jaranowski closed MCOMPILER-533.
-----------------------------------------
    Fix Version/s:     (was: waiting-for-feedback)
       Resolution: Won't Fix

> Output an error when --release option is used together with --source or 
> --target
> --------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-533
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-533
>             Project: Maven Compiler Plugin
>          Issue Type: Improvement
>    Affects Versions: 3.11.0
>            Reporter: Arend v. Reinersdorff
>            Priority: Major
>
> javac outputs an error when the --release option is used together with the 
> --source or --target option. See 
> [https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-release]
> For example:
> {{javac --release 17 --target 17 ...}}
> Will fail with this error:
> {{error: option --target cannot be used together with --release}}
> This is nice because it informs the user of misconfiguration and enforces the 
> use of only \-\-release or only \-\-source/--target.
> Unfortunately, the error is lost when compiling with Maven. Maven uses the 
> release option and silently ignores source and target. Users don't notice 
> when they unnecessarily set both. See for example 
> [https://github.com/spring-projects/spring-boot/pull/34761]
> For example:
> {{<plugin>}}
> {{    <groupId>org.apache.maven.plugins</groupId>}}
> {{    <artifactId>maven-compiler-plugin</artifactId>}}
> {{    <version>3.11.0</version>}}
> {{    <configuration>}}
> {{        <release>17</release>}}
> {{        <source>17</source>}}
> {{        <target>17</target>}}
> {{    </configuration>}}
> {{</plugin>}}
> Compiles using the release option without any error or warning.
> It would be nice to restore the error from javac in Maven, or output a 
> similar one.
> The problem I see is that Maven uses default values for source and target. 
> When the user sets only the release option, no error or warning should be 
> caused because of the default values for source and target.



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

Reply via email to