You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2021/01/29 16:54:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17274567#comment-17274567 ] 

Michael Osipov commented on MCOMPILER-452:
------------------------------------------

That's not related to this plugin, but you generally cannot remove properies, but only overwrite.

> 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
>            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)