diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/MergeAgentFilesMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/MergeAgentFilesMojo.java index f752db16..b5b9d35c 100644 --- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/MergeAgentFilesMojo.java +++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/MergeAgentFilesMojo.java @@ -75,6 +75,8 @@ public class MergeAgentFilesMojo extends AbstractMergeAgentFilesMojo { private static int numberOfExecutions = 0; + private static final List DEFAULT_DIRS = Arrays.asList("main", "test"); + @Override public void execute() throws MojoExecutionException { // we need this mojo to be executed only once @@ -96,15 +98,14 @@ public void execute() throws MojoExecutionException { } List disabledPhases = agentConfiguration.getMetadataCopyConfiguration().getDisabledStages(); - if (disabledPhases.size() == 2) { + + Set dirs = new HashSet<>(DEFAULT_DIRS); + dirs.removeAll(disabledPhases); + if (dirs.isEmpty()) { logger.info("Both phases are skipped."); return; } - Set dirs = new HashSet(2); - dirs.addAll(Arrays.asList("main", "test")); - dirs.removeAll(disabledPhases); - for (String dir : dirs) { String agentOutputDirectory = (target + "/native/agent-output/" + dir).replace('/', File.separatorChar); mergeForGivenDir(agentOutputDirectory);