You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (Jira)" <ji...@apache.org> on 2021/09/10 17:49:00 UTC
[jira] [Closed] (MCOMPILER-452) release cannot be emptied to
activate profiles compiling with previous Java version
[ https://issues.apache.org/jira/browse/MCOMPILER-452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte closed MCOMPILER-452.
------------------------------------
Assignee: Robert Scholte
Resolution: Invalid
Can't be fixed at this level. Concept of Maven is to override, not to remove.
> release cannot be emptied to activate profiles compiling with previous Java version
> -----------------------------------------------------------------------------------
>
> Key: MCOMPILER-452
> URL: https://issues.apache.org/jira/browse/MCOMPILER-452
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.8.1
> Reporter: Lugan
> Assignee: Robert Scholte
> Priority: Minor
>
> I am working on a project where some sub modules maven are in compiled in Java 8, some other in Java 11.
> For modules where sources must be compiled in Java 8, we still want to write our tests in Java 11.
> I have defined 2 profiles :
> * Java 11 by default with the maven.compiler.release property set
> * Java 8 where the maven.compiler.release property is empty :
> {code:xml}
> <properties>
> <maven.compiler.source>1.8</maven.compiler.source>
> <maven.compiler.target>1.8</maven.compiler.target>
> <maven.compiler.release></maven.compiler.release>
> </properties>
> {code}
> I have a IllegalArugmentException :
> {code:java}
> Caused by: java.lang.NumberFormatException: For input string: ""
> at java.lang.NumberFormatException.forInputString (NumberFormatException.java:65)
> at java.lang.Integer.parseInt (Integer.java:662)
> at java.lang.Integer.valueOf (Integer.java:983)
> at org.apache.maven.plugin.compiler.TestCompilerMojo.preparePaths (TestCompilerMojo.java:306)
> {code}
> After inspecting the plugin source code on github, I have found that release variable is tested to be null or not :
> {code:java}
> if ( release != null )
> {
> if ( Integer.valueOf( release ) < 9 )
> {
> {code}
> https://github.com/apache/maven-compiler-plugin/blob/master/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
> It would be more robust by checking if release is neither null nor empty.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)