How to use the 'org.springframework.experimental.aot' plugin?
w0fv1 opened this issue · comments
Here is a minimal achievable example
How to use the 'org.springframework.experimental.aot' plugin?
Description:
I'm trying spring native, I used graalvm:
D:\project\graalTest>java --version
openjdk 17.0.5 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
If I don't add the org.springframework.experimental.aot plug-in, everything is fine, and the binary file can be compiled.
But if I add the org.springframework.experimental.aot plugin
, the gradle build fails
PS D:\project\graalTest> .\gradlew build
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\project\graalTest\build.gradle' line: 6
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.experimental.aot', version: '0.12.1']
> Failed to apply plugin 'org.springframework.experimental.aot'.
> Cannot add a SourceSet with name 'aotTest' as a SourceSet with that name already exists.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 665ms
Here is the build.gradle file content, you can also see it here
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.0'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.graalvm.buildtools.native' version '0.9.18'
id 'org.springframework.experimental.aot' version '0.12.1'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
My English is not good, if you don't understand, please ask me a few more words, and urge Google Translate to do better.
Thank you very much
Replenish:
I read the documentation, but I still don't understand what should I do?
The mouse is in the wrong place
The org.springframework.experimental.aot
plugin (with experimental
in the name) is only for use with Spring Boot 2.7.x. With Spring Boot 3.x it is not required, as shown in the Spring Boot documentation.
Thank you.
I have other problems now, can't verify, but logically it should just be me being stupid
Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.
As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the related Spring project (Spring Framework, Data, Security, Boot, Cloud, etc.) with a reproducer.
Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.