Skip to content

Commit

Permalink
Add a parameter to be able to skip build native for pom type modules,…
Browse files Browse the repository at this point in the history
… leave it as false per default for backward compat

Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy authored and fniephaus committed May 7, 2024
1 parent d4b5ce3 commit 9f8dbd0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public class NativeCompileNoForkMojo extends AbstractNativeImageMojo {
@Parameter(property = "skipNativeBuild", defaultValue = "false")
private boolean skip;

@Parameter(property = "skipNativeBuildForPom", defaultValue = "false")
private boolean skipNativeBuildForPom;

private PluginParameterExpressionEvaluator evaluator;

@Override
Expand All @@ -88,6 +91,11 @@ public void execute() throws MojoExecutionException {
return;
}

if(skipNativeBuildForPom && project.getPackaging().equals("pom")) {
logger.info("Skipping native-image generation (parameter 'skipNativeBuildForPom' is true).");
return;
}

evaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
maybeSetMainClassFromPlugin(this::consumeExecutionsNodeValue, "org.apache.maven.plugins:maven-shade-plugin", "transformers", "transformer", "mainClass");
maybeSetMainClassFromPlugin(this::consumeConfigurationNodeValue, "org.apache.maven.plugins:maven-assembly-plugin", "archive", "manifest", "mainClass");
Expand Down

0 comments on commit 9f8dbd0

Please sign in to comment.