Spring-boot compilation fail on Linux but ok on windows

174 Views Asked by At

I have created a brand new spring-boot project with version 3.1.1 of Spring-Boot and JDK 17. The project is shared on github.

When i compile this project on windows, i have a build success. But if i try to compile the same project on Linux, the compilation fail with error :

Fatal error compiling: error: release version 17 not supported

If i downgrade to spring-boot 3.0.8, the compilation works on Windows and on Linux.

I noticed Spring-boot 3.0.8 used maven-compiler version 3.10.1 while Spring-boot 3.1.1 used maven-compiler version 3.11.0.

A also noticed that spring-boot-parent version 3.0.8 has those properties :

    <java.version>17</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>

While Spring-boot-parent hasn't those properties, but has :

    <java.version>17</java.version>
    <maven.compiler.release>${java.version}</maven.compiler.release>

My configuration are :

On windows :

  • Windows 10
  • OpenJDK 17.0..6.0.10
  • Maven 3.9.1

On linux :

  • AlmaLinux release 8.7
  • OpenJDK Runtime Environment (Red_Hat-17.0.7.0.7-2)
  • Maven 3.9.2

If i override the property maven.compiler.release with empty value in my pom.xml file, the compilation succeed.

0

There are 0 best solutions below