-
Notifications
You must be signed in to change notification settings - Fork 9
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
Always builds a native-image event when explicitly disabled #289
Comments
You are correct that the behavior here is a bit odd. The buildpack doesn't actually look at the value, just if it's present or not. If you simply remove it instead of setting it to false, you'll get the desired behavior. We can look at changing this, but it would be a behavior/breaking change, so we'd be limited in terms of when we could introduce the change. I'll leave this as a bug request, but it could be a while before we can change this. |
The reason why I did set it in the first place, was that without setting it, the builder always builds a native image. mapOf(
"BP_JVM_VERSION" to "17",
"BPE_SPRING_PROFILES_ACTIVE" to "prod",
"BP_SPRING_CLOUD_BINDINGS_DISABLED" to "true",
"BPE_APPEND_JAVA_TOOL_OPTIONS" to "-XX:+ExtensiveErrorReports",
"BPE_DELIM_JAVA_TOOL_OPTIONS" to " ",
) I still see the builder build a native image with liberika NIK |
I'm not seeing that. The builder should include both the Also,
Thanks |
Sorry for the late reply. I now found the time to prepare a demo app. As you can see there, the only thing I did is to add |
Okay it seems like it is dependent up on the MANIFEST.MF attribute |
Oh, I see. Yes, you're right. There were some changes not too far back to auto-detect when there's a Spring Boot app that is capable of being built with native image. I think the thought was that if you were doing this then you'd likely want to have a native image app image, so we defaulted to it. A couple of thoughts:
That said, I didn't make these changes so I'm going to defer to @anthonydahanne who introduced them. He would know best the intended behavior. Hopefully he can chime in soon on this issue. |
Hello 👋! If I understand correctly, this issue, which I could reproduce using the demo.zip from you @cmdjulian (thanks for the well formulated bug report btw 🙏) is only happening with the Spring Boot Gradle plugin. With Spring Boot and Native Image buildpacks, we need to consider 4 scenarios possible:
Let's look at each of them in detail
Like you discovered, the mere presence of => what are the ways to fix this?
The Maven BOM has a native profile, that will, when activated, not only make sure AOT plugin is enabled, but also set
Well, the Gradle buildpack will
Well, the Maven buildpack will
If you want native, of course, set Well, I did not expect to write such a long comment... But I think this is where we are: I will check with Spring boot team if it would be possible to have a specific profile, or signal, to hint the buildpacks what to do; because unless we start mixing concerns between the |
I've played a bit around with it and even if we (Spring Boot) remove setting the That's because when we detect that the NBT (native-build-tools) plugin is applied, we set the Would it work by adding something to the native image buildpack, that, when |
Yes, thanks for raising it @mhalbritter I'm also facing the same issue. Are there any workarounds or solution for this with gradle? cc @anthonydahanne @dmikusa @cmdjulian |
I have a Spring Boot App with Gradle and Kotlin including
id("org.graalvm.buildtools.native") version "0.9.26"
and aMETA-INF/native-image
folder in Resources. When running bootBuildImage with paketo base builder, it builds a native image. This is fine for prod uses. For some debugging I want to build a java based image, not a native image. When I now setBP_NATIVE_IMAGE=false
, still a native image is build. I did try to exclude the plugin and also to exclude the META-INF folder, but regardless of what I try, the builder always builds a native image with liberica nik.Expected Behavior
When setting
BP_NATIVE_IMAGE=false
I would expect to not build a native-image but rather a normal jvm based image.Current Behavior
The builder builds a native image, regardless of which variables I set.
Possible Solution
Steps to Reproduce
Motivations
The text was updated successfully, but these errors were encountered: