Skip to content
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

Allow "native" Maven profile to support both NBT and buildpacks #31770

Closed
odrotbohm opened this issue Jul 15, 2022 · 4 comments
Closed

Allow "native" Maven profile to support both NBT and buildpacks #31770

odrotbohm opened this issue Jul 15, 2022 · 4 comments
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@odrotbohm
Copy link
Member

The Spring Boot build plugins support creating native images out of the box using the build-image command that uses Buildpacks to build the GraalVM native image. Still, Boot 3.0 has introduced a dedicated build profile native that rather uses the native-maven-plugin which requires GraalVM and the native plugin installed locally.

I would appreciate if one could build images without having to declare an extra profile with boilerplate setup to use the Boot plugin built in functionality to build a Docker container with a native image contained.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 15, 2022
@snicoll
Copy link
Member

snicoll commented Jul 15, 2022

Maybe the native profile should not add an execution. I wonder if ./mvnw native:build should be used rather than package. This way we could configure the buildpack settings in the same profile and you could chose which one to use based on the goal.

@sdeleuze
Copy link
Contributor

Invoking ./mvnw native:build will not build the JAR used as input, resulting to a Execution default-cli of goal org.graalvm.buildtools:native-maven-plugin:0.9.13:build failed: Cannot invoke "java.io.File.exists()" because "artifactFile" is null on a fresh build or after a clean, or leading to potentially generating a native executable not in sync with the sources. Without execution configuration, you have to run ./mvnw package native:build which is not convenient.

That said, just running ./mvnw -Pnative spring-boot:build-image to build a native image would be a convenient and consistent behavior. Is technically possible given the fact it is "outside of Maven lifecycle" (if I am not mistaken)?

See also partially related issue #31782 for the wider context of native integration in Buildpacks.

@snicoll snicoll added type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 22, 2022
@snicoll snicoll added this to the 3.0.x milestone Jul 22, 2022
@snicoll snicoll changed the title Provide dedicated build profile for native images created via Buildpacks Allow native Maven profile to invoke Buildpacks as well Jul 22, 2022
@snicoll
Copy link
Member

snicoll commented Jul 22, 2022

We've decided to remove the execution of NBT in the native profile so that users can opt-in to either NBT or Buildpacks. This isn't really transparent at the moment as NBT requires to specify a phase on the command-line (see graalvm/native-build-tools#273) and our integration does not. As part of promoting this work, we should also fix #26455

@snicoll snicoll added the status: blocked An issue that's blocked on an external project change label Jul 22, 2022
@snicoll snicoll changed the title Allow native Maven profile to invoke Buildpacks as well Harmonize Maven 'native' profile to configure both NBT and Buildpacks Jul 25, 2022
@snicoll
Copy link
Member

snicoll commented Sep 9, 2022

See #31782

@philwebb philwebb changed the title Harmonize Maven 'native' profile to configure both NBT and Buildpacks Remove the execution of NBT in the native maven profile Oct 17, 2022
@philwebb philwebb added type: task A general task and removed status: blocked An issue that's blocked on an external project change labels Oct 17, 2022
@philwebb philwebb self-assigned this Oct 17, 2022
@philwebb philwebb modified the milestones: 3.0.x, 3.0.0-RC1 Oct 18, 2022
@snicoll snicoll changed the title Remove the execution of NBT in the native maven profile Allow "native" Maven profile to support both NBT and buildpacks Oct 18, 2022
@wilkinsona wilkinsona removed the type: task A general task label Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants