Niels Basjes created FLINK-18458:
------------------------------------

             Summary: Setting the property java.version makes the build brittle 
and harder to debug.
                 Key: FLINK-18458
                 URL: https://issues.apache.org/jira/browse/FLINK-18458
             Project: Flink
          Issue Type: Improvement
            Reporter: Niels Basjes


In the pom.xml (in various places) the property java.version is used containing 
the version of the jdk that is to be used.

There is however also a system property java.version which contains something 
"similar yet slightly different". This is the java version actually used.

This makes the exact value in this property quite brittle.

For example the profile activation in maven can be done using the *<jdk>*  
which looks at the +system+ property java.version which is different from the 
property java.version.
 * 
[https://github.com/apache/maven/blob/master/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java#L36]

Also the maven-enforcer-plugin is used with the clause

{{<requireJavaVersion>}}
{{   <version>${java.version}</version>}}
{{</requireJavaVersion>}}

Here also this rule effectively compares the system property with the regular 
property with the same name to see if they match.
 * 
[https://github.com/apache/maven-enforcer/blob/master/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVersion.java#L46]
 * 
[https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/SystemUtils.java#L529]

So although it works it also makes it impossible to debug which java.version is 
used by the various plugins as the value shown on the screen is always a 
different value.

The change is very simple: do no use java.version as a custom property.

 



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

Reply via email to