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

Add a parameter to be able to skip build native for pom type modules, leave it as false per default for backward compat #593

Merged
merged 1 commit into from May 7, 2024

Conversation

olamy
Copy link
Contributor

@olamy olamy commented Apr 28, 2024

When using in a multi module Apache Maven build, the plugin can cause some issues for pom type project.
Such

[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.10.1:compile-no-fork (build-native) on project jetty-project: Image classpath is empty. Check if your classpath configuration is correct. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.10.1:compile-no-fork (build-native) on project jetty-project: Image classpath is empty. Check if your classpath configuration is correct.
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute (BuildCacheMojosExecutionStrategy.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: Image classpath is empty. Check if your classpath configuration is correct.
    at org.graalvm.buildtools.maven.AbstractNativeImageMojo.getClasspath (AbstractNativeImageMojo.java:394)
    at org.graalvm.buildtools.maven.AbstractNativeImageMojo.getBuildArgs (AbstractNativeImageMojo.java:192)
    at org.graalvm.buildtools.maven.AbstractNativeImageMojo.buildImage (AbstractNativeImageMojo.java:408)
    at org.graalvm.buildtools.maven.NativeCompileNoForkMojo.execute (NativeCompileNoForkMojo.java:96)

See some details here jetty/jetty.project#11683

… leave it as false per default for backward compat

Signed-off-by: Olivier Lamy <olamy@apache.org>
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 28, 2024
@olamy
Copy link
Contributor Author

olamy commented Apr 28, 2024

no idea what to do to sign the OCA....
I have an account with the email used to sign this commit.
I can connect to my oracle but now when I want to sign the OCA, I get this

Screenshot from 2024-04-28 16-26-43

Please contact but there is no link provided.

@fniephaus
Copy link
Member

Hi @olamy, thanks for the PR. Maybe @alina-yur can help us find out what's going on with the OCA portal. In the meantime, could you maybe extend the description of the PR a bit and make it clear why this is needed and what problem this solves? Thank you! :)

@alina-yur
Copy link
Member

hi @olamy! Thank you for reporting, I passed your message to the OCA team. In the meantime, can you please try again (and ideally from a different browser), maybe it was a one-time glitch?

@olamy
Copy link
Contributor Author

olamy commented May 3, 2024

@alina-yur @fniephaus all good. I tried again and it works. Thanks

Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels May 3, 2024
@alina-yur
Copy link
Member

@olamy your OCA is now approved. happy contributing :)

Copy link
Collaborator

@alvarosanchez alvarosanchez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need yet another skip parameter? Is skipNativeBuild not enough?

@joakime
Copy link

joakime commented May 6, 2024

Why do you need yet another skip parameter? Is skipNativeBuild not enough?

Using that in a sub-module would also make the sub-sub-modules skip native, which is not what we want.
Skipping by packaging type is more appropriate with maven than a global skip option like skipNativeBuild.

Btw, just so you know, @olamy is a committer on the Apache Maven project itself, and is involved in countless maven plugin projects around the maven ecosystem. I trust his experience when it comes to proper maven plugin behavior and maintainability of both the maven plugin and the projects that use the maven plugin.

@alvarosanchez
Copy link
Collaborator

Using that in a sub-module would also make the sub-sub-modules skip native, which is not what we want.
Skipping by packaging type is more appropriate with maven than a global skip option like skipNativeBuild.

Right, in that case I think the mojo should just simply skip execution for pom projects, without needing an extra parameter.

@olamy I understand your intention was to not introduce breaking changes, which I appreciate, but we can probably regard this issue as a bug, in which case it's fine to do the change I proposed.

Btw, just so you know, @olamy is a committer on the Apache Maven project itself, and is involved in countless maven plugin projects around the maven ecosystem. I trust his experience when it comes to proper maven plugin behavior and maintainability of both the maven plugin and the projects that use the maven plugin.

Thanks for the heads-up. I didn't mean to question his skills at all. Mine was a pure question that, in retrospect, could have been written differently. Sorry if it sounded too harsh, not my intention.

@joakime
Copy link

joakime commented May 6, 2024

Using that in a sub-module would also make the sub-sub-modules skip native, which is not what we want.
Skipping by packaging type is more appropriate with maven than a global skip option like skipNativeBuild.

Right, in that case I think the mojo should just simply skip execution for pom projects, without needing an extra parameter.

There are many maven plugins that simply hardcode skipping of a project if it has no source, the easiest way is to skip pom packaging projects, others take a holistic approach and ask the Project if any sources have been attached (eg: extracted from another dependency via the maven-dependency-plugin and then attached as source for compilation into non-default artifacts,, even though the project is pom packaging).

This second approach also helps with nonstandard project packaging types (eg: bundle, resource, or any of a hundred other packaging types seen in the wild)

@olamy
Copy link
Contributor Author

olamy commented May 7, 2024

@alvarosanchez it looks @joakime explained perfectly why I choose this way of skipping :)

@fniephaus
Copy link
Member

Thanks a lot for contributing and making clear why this is the right approach! :)

@fniephaus fniephaus merged commit 9f8dbd0 into graalvm:master May 7, 2024
18 checks passed
@fniephaus fniephaus assigned fniephaus and unassigned dnestoro May 7, 2024
@olamy olamy deleted the skip-native-build-for-pom branch May 7, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants