Closed InYourHead closed 1 year ago
Duplicates #33940.
I don't think toolchains will help here. While a toolchain allows a plugin to fork a different JVM as needed, the plugin itself will still run in the main Maven JVM and Spring Boot 3.0's Maven plugin requires Java 17.
If toolchains are enabled, there should be an option that makes the spring-boot plugin fork a JVM and run the repackage goal under the toolchain JVM version - otherwise how is the spring-boot plugin supporting toolchains in the true sense?
How would that help? The Spring Boot plugin still has to be loaded in the main Maven JVM before it could fork a separate JVM.
How true is it that it really "has" to be in the main maven thread? I would second that it would be really nice to get a project out the spring initializer and be able to add this kind of toolchain plugin block and use the java version specified and have it actually build.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>${java.version}</version>
</jdk>
</toolchains>
</configuration>
</plugin>
I see that there is at least this verify being called
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/RunIntegrationTests.java#L137
which this I assume uses this toolchain
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/run-toolchains/toolchains.xml
but seems like that must not execute repackage. (For what it's worth I also get errors with spring-boot:run
if maven is started with java 8)
Our Maven plugin requires Java 17 and won't load on earlier versions of Java. I guess it might be technically possible for us to develop a small Java 8 compatible Maven plugin that forks the real plugin, but that's quite a lot of work and will add complexity to our own build which we don't want to do.
I'm trying to build spring boot appplication using maven-toolchains-plugin, and i realized, that toolchains is supported, but not during repackge goal.
Example pom:
I'm using java 12 to run
And I'm getting an error:
Is there any workaround to build spring boot application with toolchains?