this is my pom configuration for spring-boot maven plugin
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>org.geosdi.rest.SpringItinerisApplication</mainClass>
<jvmArguments>--enable-preview</jvmArguments>
<jvmArguments>-Dspring.config.location=./src/main/resources/application.yml</jvmArguments>
<systemPropertyVariables>
<ITINERIS_ELASTICSEARCH_REST_PBE_KEY>$-geosdi2024,Itineris_Api??/08,??,-/77</ITINERIS_ELASTICSEARCH_REST_PBE_KEY>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
but when i run the command mvn spring-boot:run i have the following error :
java.lang.UnsupportedClassVersionError: Preview features are not enabled for org/geosdi/model/product/optical/reader/NetcdfOpticalProductReader (class file version 65.65535). Try running with '--enable-preview'.
Seems that the jvmArguments define in the plugin have no effect. In the class NetcdfOpticalProductReader i use a jdk 21 preview Feature.
Regards Giuseppe
Comment From: wilkinsona
You've declared <jvmArguments> twice. Maven's behavior is that the last one wins so your app's only JVM argument is -Dspring.config.location=./src/main/resources/application.yml. You need to use the following instead:
<jvmArguments>--enable-preview -Dspring.config.location=./src/main/resources/application.yml</jvmArguments>
If you have any further questions, please follow up on Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.
Comment From: glascaleia
Thanks a lot. Regards Giuseppe