I use a spring initializer to create a spring project:
I want to create a project based on Java 15.
But I see only versions 17, 11, and 8.
Any idea why I don't see version 15?
CodePudding user response:
Any idea why I don't see version 15?
Because this is not a LTS java version. LTS means long time support.
But I see only versions 17, 11, and 8
Because those are the LTS java versions provided by ORACLE.
More about LTS java versions here
It would make sense to deliver a spring project which is based on a long term supported JDK right? You could configure it otherwise but to officially deliver a product with a non long term supported JDK would not be a decision that most would make.
CodePudding user response:
This worked for me for Java 14, so I think it should work for 15. Be sure to test it before you start your project. Also this is for spring boot. In your pom:
<properties>
<java.version>15</java.version>
</properties>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>15</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>