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

[jira] [Created] (MCOMPILER-452) release cannot be emptied to activate profiles compiling with previous Java version

Lugan created MCOMPILER-452:
-------------------------------

             Summary: 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


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

I would like to contribute by checking if release is neither null nor empty. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)