You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Petr Kuzel (Jira)" <ji...@apache.org> on 2023/05/24 07:08:00 UTC

[jira] [Created] (CAMEL-19384) Wrong declaration of minimal Java version on pom (inherited)

Petr Kuzel created CAMEL-19384:
----------------------------------

             Summary: Wrong declaration of minimal Java version on pom (inherited)
                 Key: CAMEL-19384
                 URL: https://issues.apache.org/jira/browse/CAMEL-19384
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 3.21.0
         Environment: eclipse 2023-03 on Windows with JDK 8 and JDK 11.
            Reporter: Petr Kuzel


By [https://camel.apache.org/manual/what-are-the-dependencies.html |https://camel.apache.org/manual/what-are-the-dependencies.html]Camel 3.21.x depends on Java 11.

 

But it is not correctly declared in Camel poms so eclipse 2023-03 m2e selects JDK 8 to run maven and the build fails with puzzling low-level errors on class file format incompatibility.

 
h3. Eclipse Perspective

Eclipse 2023-03 detects Java version to be used for executing maven from 
the `requireJavaVersion` element of the `maven-enforcer-plugin` configuration.

[https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#220]

Investigating the component pom's parents chain, I have found at the top-most parent pom:

{{  <groupId>org.apache</groupId>}}
{{  <artifactId>apache</artifactId>}}
{{{}  <version>29</version>{}}}{{{{}}{}}}

{{  <properties>}}

{{    <minimalJavaBuildVersion>{*}1.8{*}</minimalJavaBuildVersion>}}



 

{{  <id>enforce-java-version</id>}}
{{  ...}}

{{  <configuration>}}
{{    <rules>}}
{{      <requireJavaVersion>}}
{{         <version>${minimalJavaBuildVersion}</version>}}



 

consequently it is better to specify in the component pom:

{{  <properties>}}
{{    <minimalJavaBuildVersion>{*}11{*}</minimalJavaBuildVersion>}}

 

to get a warning if eclipse m2e selects a lower JDK version:

  [INFO] --- enforcer:3.0.0:enforce (enforce-java-version) @ camel-azure-files ---  [WARNING] Rule 0:    org.apache.maven.plugins.enforcer.RequireJavaVersion failed with    message:
{{  Detected JDK Version: 1.8.0-271 is not in the allowed range 11.}}

 

rather than crashing on class file format incompatibility errors. 

 
h3. Expected Behaviour

Minimal Java build version is not eclipse specific, it just happens eclipse leverages it, so   Camel should at a proper pom level (could be the Camel root pom) declare: 

 

{{{{  <properties>}}}}
{{{}    <minimalJavaBuildVersion>{}}}{{{}{matches [https://camel.apache.org/manual/what-are-the-dependencies.html]}{}}}{{{}</minimalJavaBuildVersion>{}}}

 

Hope it helps.



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