Details
-
Task
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.21.0
-
None
-
eclipse 2023-03 on Windows with JDK 8 and JDK 11.
-
Advanced
Description
By 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.
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:
[[1;34mINFO[m] [1m--- [0;32menforcer:3.0.0:enforce[m [1m(enforce-java-version)[m @ [36mcamel-azure-files[0;1m ---[m [[1;33mWARNING[m] 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.
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>{{{}
{}}}</minimalJavaBuildVersion>
Hope it helps.
Attachments
Issue Links
- links to