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

Skip native-image step when using "native build tools maven plugin" #599

Open
zhoufenqin opened this issue May 16, 2023 · 2 comments
Open
Labels
type:enhancement A general enhancement

Comments

@zhoufenqin
Copy link

When using this buildpack to build a native image, it will use paketo-buildpacks/native-image buildpack to run native-image command.

What if I configure the Native Build Tools Maven Plugin in my project, like this, then pass BP_MAVEN_BUILD_ARGUMENTS="-Pnative native:compile" during build time, I think there is no need to use paketo-buildpacks/native-image to run native-image command again. But in the current realization, the native-image will always be picked up, so I need to pass BP_NATIVE_IMAGE_BUILD_ARGUMENTS for it.

what is the best practice to build a native image?

Describe the Enhancement

Should support to choose use Native Build Tools Maven Plugin or use native-image separately.

Possible Solution

Motivation

@dmikusa
Copy link
Contributor

dmikusa commented May 17, 2023

Thanks for opening this issue. We have discussed doing this.

Right now, the limitation is that the buildpacks expect the output of the Maven/Gradle build process to be a JAR/WAR. You can override the default and point them to a native-image build, but they still expect the file you're pointing at to be a JAR/WAR file (or if you point to the JAR/WAR from your build, then buildpacks will rebuild your native-image which is wrong).

We would also need a way to set the process types for the native-image binary and do SBOM scanning. Right now, that happens in the native-image buildpack.

For other reads and to help us gauge interest in this, please 👍 if this feature is of interest.


For the time being, the suggest path is to have your Maven/Gradle build produce a JAR/WAR file and enable native-image builds using the paketo-buildpacks/native-image buildpack. This should work roughly the same, but it runs native-image directly, instead of from Maven/Gradle.

https://paketo.io/docs/howto/java/#build-an-app-as-a-graalvm-native-image-application

@dmikusa dmikusa added the type:enhancement A general enhancement label May 17, 2023
@anthonydahanne
Copy link
Member

this issue/idea, relates to: paketo-buildpacks/native-image#192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants