-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Exclude spring-boot-devtools from AOT processing and native images built with Maven #32853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Based on my test with Spring Boot 3.0.1, the behavior I see is that creating a project on https://start.spring.io/ with native and Devtools works with Gradle but is broken with Maven at runtime with this exception: Maybe fixing this issue would fix that error and remove the bloat at the same time? |
I have encountered the same issue with maven when using spring-boot:build-image the native image will work, but when using native:compile running the executable will fail due to devtools even though it was configured as an optional dependency. |
We can exclude the devtools in Exclude exclude = new Exclude();
exclude.setGroupId("org.springframework.boot");
exclude.setArtifactId("spring-boot-devtools");
return getClassPath(directories, new ExcludeTestScopeArtifactFilter(), new ExcludeFilter(exclude)); But this only excludes the devtools from the AOT processing phase, not from the inclusion in the native image and it will still fail when the native binary runs. We don't supply native-image with the classpath, this is done in the One can override the whole classpath used for native compilation. We don't do that in our starter-parent, we only point native-image to our classes (application classes and AOT generated classes) and let native image itself figure out the classpath. I think the way forward would be to add something to What do you think? |
That sounds like a good long-term solution although I wonder if they'd agree to the extra complexity for something that is probably quite unusual. In the shorter term, I think we should consider updating |
Projects with devtools included are now working again with Maven. The The problem with excluding devtools from the classpath when building a native image still stands. |
+1. Also experiencing this issue. |
@oliveryasuna what problem are you experiencing? AFAIK, there are no longer any problems with Devtools in a native image as it will be disabled. |
Could be #35853, this currently breaks Petlinic with Maven when |
Thanks, @sdeleuze. I'd forgotten about that one. @oliveryasuna, are you using Spring Boot 3.1.0? |
Hi @wilkinsona, I am experiencing the same issue using Spring Boot 3.1.0. When spring-boot-devtools are included in pom.xml, the application throws the following exception at startup:
|
My workaround was to make |
Thanks, both. This should bee fixed in tomorrow's 3.1.1 release through #35853. |
@wilkinsona Yes, I am using 3.1.0. AOT includes Devtools. |
To hopefully get the ball rolling again, I've submitted a RFE for the native image Maven plugin, see graalvm/native-build-tools#612 |
graalvm/native-build-tools#612 has been resolved and should be released in NBT 0.10.6. |
We've had a couple of issues in this area already:
spring-boot-devtools
is included as developmentOnly dependency #32843The first was Maven-specific as, when using Gradle, the
developmentOnly
configuration meant that DevTools wasn't on the classpath when performing AOT processing with Gradle. It was fixed by disabling DevTools during AOT processing. The second was Gradle-specific asdevelopmentOnly
dependencies were only the classpath of the native image but they hadn't been processed ahead-of-time so a failure occurred when the native image was started.With the first fix in place, a Maven-built native image will include DevTools but it'll be disabled. As such, its inclusion is benign other than bloating the image. That bloat is only ~145KB as far as I can tell, but we should eliminate it if we can by removing DevTools from the classpath.
The text was updated successfully, but these errors were encountered: