This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new b5084c5b37 fix: correct concurrent builder ordering for
lifecycle-bound aggregators
b5084c5b37 is described below
commit b5084c5b373243253b7679838106c5b3df0fc15e
Author: Goutam Adwant <[email protected]>
AuthorDate: Thu Nov 5 13:36:58 2026 -0800
fix: correct concurrent builder ordering for lifecycle-bound aggregators
Schedule aggregator goals after all collected subprojects finish their
declared phase.
Suppress inherited copies when a reactor ancestor provides the same
execution.
Wire DAG barriers so downstream consumers wait for aggregated outputs.
Fixes #13763
---
.../lifecycle/internal/concurrent/BuildPlan.java | 5 +
.../internal/concurrent/BuildPlanExecutor.java | 253 +++++++++++++++-
.../internal/concurrent/BuildPlanExecutorTest.java | 207 +++++++++++++
...ITmng13763ConcurrentAggregatorOrderingTest.java | 326 +++++++++++++++++++++
.../MavenITmng13763ConcurrentAggregatorTest.java | 269 +++++++++++++++++
.../mng-13763/managed-barrier/a/aa/pom.xml | 37 +++
.../resources/mng-13763/managed-barrier/a/pom.xml | 41 +++
.../resources/mng-13763/managed-barrier/pom.xml | 55 ++++
.../src/test/resources/mng-13763/managed/a/pom.xml | 44 +++
.../src/test/resources/mng-13763/managed/b/pom.xml | 44 +++
.../src/test/resources/mng-13763/managed/pom.xml | 87 ++++++
.../test/resources/mng-13763/nonparent/a/pom.xml | 44 +++
.../src/test/resources/mng-13763/nonparent/pom.xml | 52 ++++
.../resources/mng-13763/outputs/consumer/pom.xml | 52 ++++
.../resources/mng-13763/outputs/group/a/pom.xml | 44 +++
.../test/resources/mng-13763/outputs/group/pom.xml | 51 ++++
.../src/test/resources/mng-13763/outputs/pom.xml | 30 ++
.../src/test/resources/mng-13763/plugin/pom.xml | 58 ++++
.../apache/maven/its/mng13763/AggregateMojo.java | 99 +++++++
.../org/apache/maven/its/mng13763/CheckMojo.java | 48 +++
.../org/apache/maven/its/mng13763/ConsumeMojo.java | 30 ++
.../org/apache/maven/its/mng13763/TouchMojo.java | 52 ++++
.../mng-13763/profile-properties/a/pom.xml | 72 +++++
.../resources/mng-13763/profile-properties/pom.xml | 52 ++++
.../test/resources/mng-13763/properties/a/pom.xml | 47 +++
.../test/resources/mng-13763/properties/pom.xml | 52 ++++
.../test/resources/mng-13763/reactor/a/aa/pom.xml | 29 ++
.../src/test/resources/mng-13763/reactor/a/pom.xml | 101 +++++++
.../src/test/resources/mng-13763/reactor/b/pom.xml | 44 +++
.../src/test/resources/mng-13763/reactor/pom.xml | 55 ++++
.../src/test/resources/mng-13763/settings.xml | 27 ++
31 files changed, 2397 insertions(+), 10 deletions(-)
diff --git
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java
index 421955ebbc..d82f4d61bb 100644
---
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java
+++
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java
@@ -69,6 +69,11 @@ public void addProject(MavenProject project, Map<String,
BuildStep> steps) {
public void addStep(MavenProject project, String name, BuildStep step) {
plan.get(project).put(name, step);
+ invalidateOrdering();
+ }
+
+ void invalidateOrdering() {
+ sortedNodes = null;
}
public Stream<BuildStep> allSteps() {
diff --git
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
index f2c5d68254..5481ffe7b5 100644
---
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
+++
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
@@ -25,12 +25,15 @@
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -75,8 +78,10 @@
import org.apache.maven.lifecycle.internal.ReactorContext;
import org.apache.maven.lifecycle.internal.Task;
import org.apache.maven.lifecycle.internal.TaskSegment;
+import org.apache.maven.model.InputLocation;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.Profile;
import org.apache.maven.plugin.MavenPluginManager;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoNotFoundException;
@@ -202,6 +207,8 @@ class BuildContext implements AutoCloseable {
final ReadWriteLock lock = new ReentrantReadWriteLock();
final int threads;
BuildPlan plan;
+ final Map<BuildStep, BuildStep> aggregationEnds = new HashMap<>();
+ final Map<MavenProject, MavenProject> reactorProjects = new
HashMap<>();
BuildContext(MavenSession session, ReactorContext reactorContext,
List<TaskSegment> taskSegments) {
this.session = session;
@@ -420,7 +427,10 @@ private void processStep(BuildStep step) {
} else {
// For regular steps:
// Don't run for halted builds, blacklisted projects, or if
predecessors failed
- shouldExecute = !status.isHalted() &&
!status.isBlackListed(step.project) && allPredecessorsExecuted;
+ shouldExecute = !status.isHalted()
+ && !status.isBlackListed(step.project)
+ && allPredecessorsExecuted
+ && (!step.name.startsWith("$aggregator:") ||
aggregationWorkSucceeded(step));
}
// 2. Either schedule the step or mark it as skipped based on the
decision
@@ -472,6 +482,16 @@ private void processStep(BuildStep step) {
}
}
+ private boolean aggregationWorkSucceeded(BuildStep step) {
+ // Cleanup steps may finish successfully after nested work failed
or was skipped.
+ // They are not proof that the work required by an aggregator
completed.
+ return step.allPredecessors()
+ .filter(predecessor -> predecessor != step)
+ .allMatch(predecessor -> predecessor.exception == null
+ && predecessor.status.get() != FAILED
+ && (!predecessor.hasExecutions() ||
predecessor.status.get() == EXECUTED));
+ }
+
private void executePlan() {
// Even if the build is halted, we still want to execute TEARDOWN
and after:* steps
// for proper cleanup, so we don't return early here
@@ -619,6 +639,9 @@ private Clock getClock(Object key) {
private void plan() {
lock.writeLock().lock();
try {
+ if (reactorProjects.isEmpty()) {
+ plan.getAllProjects().keySet().forEach(project ->
reactorProjects.put(project, project));
+ }
Set<BuildStep> planSteps = plan.allSteps()
.filter(step -> PLAN.equals(step.name))
.filter(step -> step.predecessors.stream().allMatch(s
-> s.status.get() == EXECUTED))
@@ -642,16 +665,12 @@ private void plan() {
plan.step(project, resolvedPhase).ifPresent(n
-> {
MojoExecution mojoExecution = new
MojoExecution(mojoDescriptor, execution.getId());
mojoExecution.setLifecyclePhase(phase);
- n.addMojo(mojoExecution,
execution.getPriority());
- if
(mojoDescriptor.getDependencyCollectionRequired() != null
- ||
mojoDescriptor.getDependencyResolutionRequired() != null) {
- for (MavenProject p :
-
plan.getAllProjects().get(project)) {
- plan.step(p, AFTER + PACKAGE)
- .ifPresent(a ->
plan.requiredStep(project, resolvedPhase)
- .executeAfter(a));
- }
+ if (requiresAggregation(n, mojoExecution)
+ && inheritedFromReactorAncestor(
+ project, plugin,
execution, goal, resolvedPhase)) {
+ return;
}
+ n.addMojo(mojoExecution,
execution.getPriority());
// Apply @After annotation ordering
constraints from the mojo descriptor
applyAfterLinks(mojoDescriptor, project,
resolvedPhase);
});
@@ -660,6 +679,23 @@ private void plan() {
}
}
+ for (BuildStep step : planSteps) {
+ splitAggregatorSteps(step.project);
+ plan.steps(step.project)
+ .filter(executionStep -> executionStep.phase !=
null)
+ .forEach(executionStep ->
executionStep.executions().forEach(execution -> {
+ MojoDescriptor descriptor =
execution.getMojoDescriptor();
+ if
(descriptor.getDependencyCollectionRequired() != null
+ ||
descriptor.getDependencyResolutionRequired() != null) {
+ for (MavenProject upstream :
+
plan.getAllProjects().get(step.project)) {
+ plan.step(upstream, AFTER +
PACKAGE).ifPresent(executionStep::executeAfter);
+ }
+ }
+ }));
+ }
+ linkAggregatorSteps();
+
BuildPlan buildPlan = plan;
for (BuildStep step :
planSteps.stream().flatMap(p ->
plan.steps(p.project)).toList()) {
@@ -681,6 +717,203 @@ private void plan() {
}
}
+ private boolean requiresAggregation(BuildStep step, MojoExecution
execution) {
+ // Legacy phases such as prepare-package resolve to hooks, but
retain ordinary
+ // lifecycle aggregation semantics. Explicit native hooks keep
their own semantics.
+ return step.phase != null
+ && execution.getLifecyclePhase() != null
+ && execution.getMojoDescriptor().isAggregator()
+ && (!(step.name.startsWith(BEFORE) ||
step.name.startsWith(AFTER))
+ ||
!step.name.equals(execution.getLifecyclePhase()));
+ }
+
+ private void splitAggregatorSteps(MavenProject project) {
+ for (BuildStep step : plan.steps(project)
+ .filter(s -> !s.name.startsWith("$aggregator:"))
+ .filter(s -> !s.skip.get())
+ .filter(s -> s.executions().anyMatch(execution ->
requiresAggregation(s, execution)))
+ .toList()) {
+ var executions = step.mojos.entrySet().stream()
+ .flatMap(entry -> entry.getValue().values().stream()
+ .map(execution -> Map.entry(entry.getKey(),
execution)))
+ .toList();
+ step.mojos.clear();
+ String endName =
+ step.name.startsWith(BEFORE) ||
step.name.startsWith(AFTER) ? step.name : AFTER + step.name;
+ BuildStep phaseEnd = plan.requiredStep(project, endName);
+ BuildStep target = step;
+ int segment = 0;
+ for (var entry : executions) {
+ MojoExecution execution = entry.getValue();
+ if (requiresAggregation(step, execution)) {
+ String name = "$aggregator:" + step.name + ":" +
segment++;
+ BuildStep aggregate = new BuildStep(name, project,
step.phase);
+ aggregate.executeAfter(target);
+ aggregate.executeAfter(phaseEnd);
+ if (project.getCollectedProjects() != null) {
+ for (MavenProject child :
project.getCollectedProjects()) {
+ plan.step(child,
endName).ifPresent(aggregate::executeAfter);
+ }
+ }
+ plan.requiredStep(project,
TEARDOWN).executeAfter(aggregate);
+ plan.addStep(project, name, aggregate);
+ aggregationEnds.put(aggregate, phaseEnd);
+ target = aggregate;
+ }
+ target.addMojo(execution, entry.getKey());
+ }
+ }
+ }
+
+ void linkAggregatorSteps() {
+ // Resolve nested aggregation before downstream barriers,
independent of planning order.
+ Map<BuildStep, BuildStep> ends = new LinkedHashMap<>();
+ Map<MavenProject, List<BuildStep>> byProject = new HashMap<>();
+ plan.allSteps().filter(step ->
step.name.startsWith("$aggregator:")).forEach(aggregate -> {
+ BuildStep end = aggregationEnds.getOrDefault(
+ aggregate, plan.requiredStep(aggregate.project, AFTER
+ aggregate.phase.name()));
+ ends.put(aggregate, end);
+ byProject
+ .computeIfAbsent(aggregate.project, p -> new
ArrayList<>())
+ .add(aggregate);
+ });
+ ends.forEach((aggregate, end) -> {
+ Set<BuildStep> prerequisites =
aggregate.allPredecessors().collect(Collectors.toSet());
+ if (aggregate.project.getCollectedProjects() != null) {
+ for (MavenProject child :
aggregate.project.getCollectedProjects()) {
+ for (BuildStep childAggregate :
byProject.getOrDefault(child, List.of())) {
+ if
(!prerequisites.contains(ends.get(childAggregate))) {
+ continue;
+ }
+ if (childAggregate.isSuccessorOf(aggregate)) {
+ throw new IllegalStateException(
+ "Cyclic aggregation ordering between "
+ aggregate + " and " + childAggregate);
+ }
+ aggregate.executeAfter(childAggregate);
+ }
+ }
+ }
+ });
+ ends.forEach((aggregate, end) -> {
+ Set<BuildStep> prerequisites =
aggregate.allPredecessors().collect(Collectors.toSet());
+ Set<BuildStep> visited = new HashSet<>();
+ var successors = new ArrayDeque<>(List.copyOf(end.successors));
+ while (!successors.isEmpty()) {
+ BuildStep successor = successors.removeFirst();
+ if (successor == aggregate || !visited.add(successor)) {
+ continue;
+ }
+ if (prerequisites.contains(successor)) {
+ // Ordinary parent outputs may be needed to build
aggregate inputs.
+ // Continue beyond that readiness point instead of
losing the barrier.
+ successors.addAll(List.copyOf(successor.successors));
+ } else {
+ successor.executeAfter(aggregate);
+ }
+ }
+ });
+ plan.invalidateOrdering();
+ }
+
+ private boolean inheritedFromReactorAncestor(
+ MavenProject project, Plugin plugin, PluginExecution
execution, String goal, String phase) {
+ if (declaredInProject(project, plugin, execution, goal)) {
+ return false;
+ }
+ for (MavenProject parent = project.getParent(); parent != null;
parent = parent.getParent()) {
+ MavenProject reactorParent = reactorProjects.get(parent);
+ MavenProject ancestor = reactorParent != null ? reactorParent
: parent;
+ for (Plugin parentPlugin : ancestor.getBuild().getPlugins()) {
+ if (!parentPlugin.getKey().equals(plugin.getKey())) {
+ continue;
+ }
+ boolean matchingExecution = false;
+ for (PluginExecution parentExecution :
parentPlugin.getExecutions()) {
+ if
(!parentExecution.getId().equals(execution.getId())) {
+ continue;
+ }
+ matchingExecution = true;
+ boolean inherited = parentExecution.getInherited() !=
null
+ ? parentExecution.isInherited()
+ : parentPlugin.isInherited();
+ if (!inherited ||
!Objects.equals(parentPlugin.getVersion(), plugin.getVersion())) {
+ return false;
+ }
+ if (parentExecution.getGoals().contains(goal)
+ && reactorParent != null
+ && reactorParent.getCollectedProjects() != null
+ &&
reactorParent.getCollectedProjects().contains(project)) {
+ MojoDescriptor descriptor =
getMojoDescriptor(reactorParent, parentPlugin, goal);
+ String parentPhase = parentExecution.getPhase() !=
null
+ ? parentExecution.getPhase()
+ : descriptor.getPhase();
+ String resolved =
plan.aliases().getOrDefault(parentPhase, parentPhase);
+ if (resolved != null && resolved.startsWith(AT)) {
+ resolved = resolved.substring(AT.length());
+ }
+ if (descriptor.isAggregator()
+ && Objects.equals(resolved, phase)
+ && plan.step(reactorParent, phase)
+ .filter(step -> !step.skip.get())
+ .isPresent()) {
+ return true;
+ }
+ }
+ }
+ if (!matchingExecution && !parentPlugin.isInherited()) {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean declaredInProject(MavenProject project, Plugin plugin,
PluginExecution execution, String goal) {
+ // Goal locations survive model interpolation. Compare their POM
paths rather
+ // than raw coordinates, which may contain expressions such as
${pluginGroup}.
+ InputLocation goals = execution.getLocation("goals");
+ InputLocation location = goals == null
+ ? null
+ : goals.getLocation(execution.getGoals().indexOf(goal));
+ if (declaredInProject(project, location)) {
+ return true;
+ }
+ var model = project.getOriginalModel();
+ if (model == null) {
+ return false;
+ }
+ Stream<Plugin> plugins = model.getBuild() == null ? Stream.empty()
: model.getBuild().getPlugins().stream();
+ Set<String> activeProfiles = project.getActiveProfiles() == null
+ ? Set.of()
+ : project.getActiveProfiles().stream()
+ .filter(profile -> declaredInProject(project,
profile.getLocation("")))
+ .map(Profile::getId)
+ .collect(Collectors.toSet());
+ plugins = Stream.concat(
+ plugins,
+ // Merged goal lists do not retain every source location.
Local profiles
+ // in the effective model preserve their interpolated
declarations.
+ project.getModel().getProfiles().stream()
+ .filter(profile ->
activeProfiles.contains(profile.getId()))
+ .filter(profile -> profile.getBuild() != null)
+ .flatMap(profile ->
profile.getBuild().getPlugins().stream()));
+ return plugins.filter(p -> p.getKey().equals(plugin.getKey()))
+ .flatMap(p -> p.getExecutions().stream())
+ .anyMatch(e ->
+ e.getId().equals(execution.getId()) &&
e.getGoals().contains(goal));
+ }
+
+ private boolean declaredInProject(MavenProject project, InputLocation
location) {
+ return location != null
+ && location.getSource() != null
+ && project.getFile() != null
+ && project.getFile()
+ .toPath()
+ .toUri()
+ .toString()
+ .equals(location.getSource().getLocation());
+ }
+
/**
* Applies lifecycle ordering constraints from {@code @After}
annotations on a mojo descriptor.
* Each {@link AfterLink} is translated into build step ordering
edges, matching the same
diff --git
a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutorTest.java
b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutorTest.java
index 9ef77e95bf..a6b2fac890 100644
---
a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutorTest.java
+++
b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutorTest.java
@@ -19,6 +19,7 @@
package org.apache.maven.lifecycle.internal.concurrent;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
@@ -47,11 +48,217 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
class BuildPlanExecutorTest {
+ @Test
+ void aggregateOutputsAreReadyBeforeExternalConsumers() {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ MavenProject consumer = newProject();
+ consumer.setArtifactId("consumer");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of(root), consumer, List.of(root)));
+ for (MavenProject project : List.of(root, child, consumer)) {
+ context.plan.addProject(project, new HashMap<>());
+ }
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ BuildStep childCompile = addStep(context.plan, child, "compile");
+ BuildStep consumerCompile = addStep(context.plan, consumer, "compile");
+ aggregate.executeAfter(end);
+ aggregate.executeAfter(childEnd);
+ childEnd.executeAfter(childCompile);
+ childCompile.executeAfter(end);
+ consumerCompile.executeAfter(end);
+
+ context.linkAggregatorSteps();
+
+ assertTrue(consumerCompile.isSuccessorOf(aggregate));
+ assertFalse(childCompile.isSuccessorOf(aggregate), "do not introduce a
parent/child dependency cycle");
+ assertTrue(aggregate.isSuccessorOf(childEnd));
+ }
+
+ @Test
+ void laterPlannedAggregatorUsesAggregationInsteadOfInheritance() {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of()));
+ context.plan.addProject(root, new HashMap<>());
+ context.plan.addProject(child, new HashMap<>());
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ aggregate.executeAfter(end);
+ aggregate.executeAfter(childEnd);
+ context.linkAggregatorSteps();
+
+ BuildStep childAggregate = addStep(context.plan, child,
"$aggregator:package");
+ childAggregate.executeAfter(childEnd);
+ context.linkAggregatorSteps();
+
+ assertTrue(aggregate.isSuccessorOf(childAggregate));
+ assertFalse(childAggregate.isSuccessorOf(aggregate));
+ }
+
+ @Test
+ void laterPlannedConsumerWaitsForExistingAggregator() {
+ MavenProject root = newProject();
+ MavenProject consumer = newProject();
+ consumer.setArtifactId("consumer");
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), consumer,
List.of(root)));
+ context.plan.addProject(root, new HashMap<>());
+ context.plan.addProject(consumer, new HashMap<>());
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ aggregate.executeAfter(end);
+ context.linkAggregatorSteps();
+
+ BuildStep consumerCompile = addStep(context.plan, consumer, "compile");
+ consumerCompile.executeAfter(end);
+ context.linkAggregatorSteps();
+
+ assertTrue(consumerCompile.isSuccessorOf(aggregate));
+ }
+
+ @Test
+ void transitiveConsumerWaitsForAggregate() {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ MavenProject consumer = newProject();
+ consumer.setArtifactId("consumer");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of(root), consumer, List.of(root, child)));
+ for (MavenProject project : List.of(root, child, consumer)) {
+ context.plan.addProject(project, new HashMap<>());
+ }
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ BuildStep consume = addStep(context.plan, consumer, "compile");
+ childEnd.executeAfter(end);
+ aggregate.executeAfter(childEnd);
+ consume.executeAfter(childEnd);
+ consume.executeAfter(end); // Elided because it is already reachable
through childEnd.
+
+ context.linkAggregatorSteps();
+
+ assertTrue(consume.isSuccessorOf(aggregate));
+ assertFalse(childEnd.isSuccessorOf(aggregate));
+ }
+
+ @Test
+ void laterPhaseWaitsForAggregateWhenReadinessCannot() {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of(root)));
+ context.plan.addProject(root, new HashMap<>());
+ context.plan.addProject(child, new HashMap<>());
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep ready = addStep(context.plan, root, "ready");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ BuildStep laterPhase = addStep(context.plan, root, "install");
+ ready.executeAfter(end);
+ childEnd.executeAfter(ready);
+ aggregate.executeAfter(childEnd);
+ laterPhase.executeAfter(ready);
+
+ context.linkAggregatorSteps();
+ context.linkAggregatorSteps();
+
+ assertFalse(ready.isSuccessorOf(aggregate));
+ assertTrue(laterPhase.isSuccessorOf(aggregate));
+ assertFalse(aggregate.isSuccessorOf(laterPhase));
+ }
+
+ @Test
+ void nestedAggregationPrecedesAncestorRegardlessOfPlanningOrder() {
+ for (boolean deferred : List.of(false, true)) {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
+ newExecutor((BeforeProjectExecution) event -> {}).new
BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of(root)));
+ context.plan.addProject(root, new HashMap<>());
+ context.plan.addProject(child, new HashMap<>());
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ childEnd.executeAfter(end);
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ aggregate.executeAfter(childEnd);
+ if (deferred) {
+ context.linkAggregatorSteps();
+ }
+ BuildStep childAggregate = addStep(context.plan, child,
"$aggregator:package");
+ childAggregate.executeAfter(childEnd);
+
+ context.linkAggregatorSteps();
+ context.linkAggregatorSteps();
+
+ assertTrue(aggregate.isSuccessorOf(childAggregate));
+ assertFalse(childAggregate.isSuccessorOf(aggregate));
+ }
+ }
+
+ @Test
+ void earlierChildAggregationPrecedesAncestorBarrier() {
+ MavenProject root = newProject();
+ MavenProject child = newProject();
+ child.setArtifactId("child");
+ root.setCollectedProjects(List.of(child));
+ BuildPlanExecutor.BuildContext context =
newExecutor((BeforeProjectExecution) event -> {}).new BuildContext();
+ context.plan = new BuildPlan(Map.of(root, List.of(), child,
List.of(root)));
+ context.plan.addProject(root, new HashMap<>());
+ context.plan.addProject(child, new HashMap<>());
+ BuildStep end = addStep(context.plan, root, "after:package");
+ BuildStep childBefore = addStep(context.plan, child, "before:package");
+ BuildStep childEnd = addStep(context.plan, child, "after:package");
+ childBefore.executeAfter(end);
+ childEnd.executeAfter(childBefore);
+ BuildStep aggregate = addStep(context.plan, root,
"$aggregator:package");
+ aggregate.executeAfter(childEnd);
+ BuildStep childAggregate = addStep(context.plan, child,
"$aggregator:before:package:0");
+ childAggregate.executeAfter(childBefore);
+ context.aggregationEnds.put(childAggregate, childBefore);
+
+ context.linkAggregatorSteps();
+
+ assertTrue(aggregate.isSuccessorOf(childAggregate));
+ assertTrue(childEnd.isSuccessorOf(childAggregate));
+ assertFalse(childAggregate.isSuccessorOf(aggregate));
+ }
+
+ private BuildStep addStep(BuildPlan plan, MavenProject project, String
name) {
+ Lifecycle.Phase phase = new
DefaultLifecycleRegistry(Collections.emptyList())
+ .lookup("default")
+ .orElseThrow()
+ .allPhases()
+ .filter(p -> p.name().equals("package"))
+ .findFirst()
+ .orElseThrow();
+ BuildStep step = new BuildStep(name, project, phase);
+ plan.addStep(project, name, step);
+ return step;
+ }
+
/**
* A build step that throws an {@link Error} must be reported as a build
failure, the same way the
* single threaded builder reports it. Otherwise the build ends with no
exception at all and Maven
diff --git
a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorOrderingTest.java
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorOrderingTest.java
new file mode 100644
index 0000000000..614c62feab
--- /dev/null
+++
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorOrderingTest.java
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MavenITmng13763ConcurrentAggregatorOrderingTest extends
AbstractMavenIntegrationTestCase {
+ private static final String GROUP = "org.apache.maven.its.mng13763";
+ private static final String VERSION = "1.0-SNAPSHOT";
+ private static final String PROBE =
"aggregator-ordering-probe-maven-plugin";
+
+ @Test
+ void testSiblingParentDoesNotReplaceChildAggregator() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("siblings");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>parent</module><module>child</module></modules>");
+ project(root.resolve("parent"), "", "<artifactId>parent</artifactId>"
+ plugin(VERSION, "", execution("aggregate", "package", "aggregate", "")));
+ project(root.resolve("child"), parent("parent", "../parent/pom.xml"),
"<artifactId>child</artifactId>");
+ build(root, "package").execute();
+
assertTrue(Files.exists(root.resolve("child/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ void testExecutionInheritanceOverridesPlugin() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("override");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "package", "aggregate", "<inherited>true</inherited>")));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>" + plugin(VERSION, "", ""));
+ build(root, "package").execute();
+
assertTrue(Files.exists(root.resolve("target/aggregate-observed.txt")));
+
assertFalse(Files.exists(root.resolve("a/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ void testPluginVersionChangesAggregatorFlag() throws Exception {
+ verifyPluginVersion(false);
+ }
+
+ @Test
+ void testPluginVersionChangesDefaultPhase() throws Exception {
+ verifyPluginVersion(true);
+ }
+
+ private void verifyPluginVersion(boolean defaultPhase) throws Exception {
+ Path dir = extractPlugin();
+ Path pom = dir.resolve("plugin/pom.xml");
+ Path source =
dir.resolve("plugin/src/main/java/org/apache/maven/its/mng13763/AggregateMojo.java");
+ String originalPom = Files.readString(pom);
+ String originalSource = Files.readString(source);
+ Files.writeString(pom,
originalPom.replace("<version>1.0-SNAPSHOT</version>",
"<version>0.9-SNAPSHOT</version>"));
+ Files.writeString(source, defaultPhase
+ ? originalSource.replace("LifecyclePhase.PACKAGE",
"LifecyclePhase.COMPILE")
+ : originalSource.replace("aggregator = true", "aggregator =
false"));
+ try {
+ installPlugin(dir);
+ } finally {
+ Files.writeString(pom, originalPom);
+ Files.writeString(source, originalSource);
+ }
+ installPlugin(dir);
+ Path root = dir.resolve(defaultPhase ? "default-phase" : "versions");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin("0.9-SNAPSHOT", "", execution("aggregate",
defaultPhase ? null : "package", "aggregate", "")));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>" + plugin(VERSION, "", ""));
+ build(root, "package").execute();
+
assertTrue(Files.exists(root.resolve("a/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ void testPreparePackageAggregatorWaitsForChildren() throws Exception {
+ verifyAlias("prepare-package");
+ }
+
+ @Test
+ void testProcessClassesAggregatorWaitsForChildren() throws Exception {
+ verifyAlias("process-classes");
+ }
+
+ private void verifyAlias(String phase) throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("alias-" + phase);
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", phase, "aggregate", ""))
+ .replace("<executions>",
"<configuration><expectedAggregates><expectedAggregate>a/target/touched.txt</expectedAggregate></expectedAggregates></configuration><executions>"));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>"
+ + plugin(VERSION, "", execution("touch", phase, "touch", "")));
+ Verifier verifier = build(root, "package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertTrue(Files.exists(root.resolve("target/aggregate-observed.txt")));
+ }
+
+ @Test
+ void testSamePhaseConsumerRunsAfterAggregator() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("sequence");
+ project(root, "", "<artifactId>root</artifactId>" + plugin(VERSION,
"", execution("ordered", "package", "aggregate</goal><goal>check", "")));
+ Verifier verifier = build(root, "package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+
+ @Test
+ void testVerifyAggregatorDoesNotRunAfterNestedTestFailure() throws
Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("failure");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module><module>b</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "verify", "aggregate", "")));
+ for (String child : new String[] {"a", "b"}) {
+ project(root.resolve(child), parent("root", "../pom.xml"),
"<artifactId>" + child + "</artifactId>"
+ + plugin(VERSION, "", execution("touch", "test", "touch",
"")));
+ }
+ Verifier verifier = build(root, "verify");
+ verifier.addCliArgument("--fail-at-end");
+ verifier.addCliArgument("-DfailModule=a");
+ assertThrows(VerificationException.class, verifier::execute);
+
assertFalse(Files.exists(root.resolve("target/aggregate-observed.txt")));
+ assertTrue(Files.exists(root.resolve("b/target/touched.txt")));
+ }
+
+ @Test
+ void testDirectAggregatorGoalKeepsCommandLineSemantics() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("direct");
+ project(root, "", "<artifactId>root</artifactId>");
+ Verifier verifier = build(root, GROUP + ":" + PROBE + ":" + VERSION +
":aggregate");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertTrue(Files.exists(root.resolve("target/aggregate-observed.txt")));
+ }
+
+ @Test
+ void testMultipleAggregatorsPreserveInterveningGoals() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("multiple");
+ project(root, "", "<artifactId>root</artifactId>" + plugin(VERSION, "",
+ execution("prefix", "package", "touch", "")
+ + execution("first", "package", "aggregate",
"<configuration><requireOwnTouch>true</requireOwnTouch></configuration>")
+ + execution("middle", "package", "check", "")
+ + execution("second", "package", "aggregate",
"<configuration><markerName>second-aggregate.txt</markerName><expectedAggregates><expectedAggregate>target/checked.txt</expectedAggregate></expectedAggregates></configuration>")
+ + execution("suffix", "package", "check",
"<configuration><expectedMarker>second-aggregate.txt</expectedMarker></configuration>")));
+ for (int threads : new int[] {1, 4}) {
+ Verifier verifier = build(root, "package", threads);
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+ }
+
+ @Test
+ void testEarlierChildAggregatorCompletesBeforeParent() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("nested-alias");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "package", "aggregate",
+
"<configuration><expectedAggregates><expectedAggregate>a/target/checked.txt</expectedAggregate></expectedAggregates></configuration>")));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>"
+ + plugin(VERSION, "", execution("aggregate",
"prepare-package", "aggregate", "")
+ + execution("check", "package", "check", "")));
+ Verifier verifier = build(root, "package", 4);
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+
+ @Test
+ void testCompileAggregatorDoesNotBlockChildReadiness() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("readiness");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "compile", "aggregate",
+
"<configuration><expectedAggregates><expectedAggregate>a/target/touched.txt</expectedAggregate></expectedAggregates></configuration>")
+ + execution("check", "package", "check", "")));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>"
+ + "<dependencies>" + dependency("root", "pom", "") +
"</dependencies>"
+ + plugin(VERSION, "", execution("touch", "compile", "touch",
"")));
+ Verifier verifier = build(root, "package", 4);
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+
+ @Test
+ void testConsumerWithTransitiveProducerEdgeWaitsForAggregate() throws
Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("transitive");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>group</module><module>consumer</module></modules>");
+ project(root.resolve("group"), parent("root", "../pom.xml"),
"<artifactId>group</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "package", "aggregate",
"<configuration><attachArtifact>true</attachArtifact></configuration>")));
+ project(root.resolve("group/a"), parent("group", "../pom.xml"),
"<artifactId>a</artifactId><dependencies>" + dependency("group", "pom", "") +
"</dependencies>");
+ project(root.resolve("consumer"), parent("root", "../pom.xml"),
"<artifactId>consumer</artifactId><dependencies>"
+ + dependency("a", "pom", "") + dependency("group", "jar",
"<classifier>aggregate</classifier>") + "</dependencies>"
+ + plugin(VERSION, "", execution("consume", "compile",
"consume", "")));
+ Verifier verifier = build(root, "package", 4);
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ verifier.verifyTextInLog("Aggregate artifact resolved");
+ }
+
+ @Test
+ void testFailureInSamePhaseSuffixPreventsLaterAggregation() throws
Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("suffix-failure");
+ project(root, "", "<artifactId>root</artifactId>" + plugin(VERSION, "",
+ execution("package", "package", "aggregate</goal><goal>touch",
"")
+ + execution("verify", "verify", "aggregate",
"<configuration><markerName>verify-aggregate.txt</markerName></configuration>")));
+ Verifier verifier = build(root, "verify");
+ verifier.addCliArgument("--fail-at-end");
+ verifier.addCliArgument("-DfailModule=suffix-failure");
+ assertThrows(VerificationException.class, verifier::execute);
+
assertTrue(Files.exists(root.resolve("target/aggregate-observed.txt")));
+ assertFalse(Files.exists(root.resolve("target/verify-aggregate.txt")));
+ }
+
+ @Test
+ void testMixedLifecycleAndDirectAggregatorGoals() throws Exception {
+ Path dir = preparePlugin();
+ Path root = dir.resolve("mixed");
+ project(root, "",
"<artifactId>root</artifactId><modules><module>a</module></modules>"
+ + plugin(VERSION, "<inherited>false</inherited>",
execution("aggregate", "package", "aggregate</goal><goal>check", "")));
+ project(root.resolve("a"), parent("root", "../pom.xml"),
"<artifactId>a</artifactId>");
+ Verifier verifier = build(root, "package", 4);
+ verifier.addCliArgument(GROUP + ":" + PROBE + ":" + VERSION +
":aggregate");
+ verifier.addCliArgument("verify");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ verifier.verifyTextInLog("aggregate (default-cli)");
+ assertTrue(Files.exists(root.resolve("target/checked.txt")));
+ }
+
+ private String dependency(String artifact, String type, String extra) {
+ return "<dependency><groupId>" + GROUP + "</groupId><artifactId>" +
artifact + "</artifactId><version>" + VERSION
+ + "</version><type>" + type + "</type>" + extra +
"</dependency>";
+ }
+
+ private Path extractPlugin() throws Exception {
+ Path source = extractResources("mng-13763").resolve("plugin");
+ Path dir = Files.createTempDirectory(source.getParent().getParent(),
"mng-13763-ordering-");
+ Path plugin = dir.resolve("plugin");
+ try (var paths = Files.walk(source.resolve("src"))) {
+ for (Path path : paths.filter(Files::isRegularFile).toList()) {
+ Path copy = plugin.resolve(source.relativize(path));
+ Files.createDirectories(copy.getParent());
+ Files.copy(path, copy);
+ }
+ }
+ Files.writeString(plugin.resolve("pom.xml"),
Files.readString(source.resolve("pom.xml"))
+
.replace("<artifactId>aggregator-probe-maven-plugin</artifactId>",
"<artifactId>" + PROBE + "</artifactId>"));
+ return dir;
+ }
+
+ private Path preparePlugin() throws Exception {
+ Path dir = extractPlugin();
+ installPlugin(dir);
+ return dir;
+ }
+
+ private void installPlugin(Path dir) throws Exception {
+ Verifier verifier = newVerifier(dir.resolve("plugin"));
+ verifier.deleteDirectory("target");
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+
+ private Verifier build(Path root, String phase) throws Exception {
+ return build(root, phase, 1);
+ }
+
+ private Verifier build(Path root, String phase, int threads) throws
Exception {
+ Verifier verifier = newVerifier(root);
+ try (var paths = Files.walk(root)) {
+ for (Path target : paths.filter(p ->
p.getFileName().toString().equals("target")).toList()) {
+ verifier.deleteDirectory(root.relativize(target).toString());
+ }
+ }
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T" + threads);
+ verifier.addCliArgument(phase);
+ return verifier;
+ }
+
+ private void project(Path dir, String parent, String body) throws
Exception {
+ Files.createDirectories(dir);
+ Files.writeString(dir.resolve("pom.xml"), "<project
xmlns=\"http://maven.apache.org/POM/4.0.0\"><modelVersion>4.0.0</modelVersion>"
+ + parent + (parent.isEmpty() ? "<groupId>" + GROUP +
"</groupId><version>" + VERSION + "</version>" : "")
+ + "<packaging>pom</packaging>" + body + "</project>");
+ }
+
+ private String parent(String artifact, String relativePath) {
+ return "<parent><groupId>" + GROUP + "</groupId><artifactId>" +
artifact + "</artifactId><version>" + VERSION
+ + "</version><relativePath>" + relativePath +
"</relativePath></parent>";
+ }
+
+ private String plugin(String version, String inheritance, String
executions) {
+ return "<build><plugins><plugin><groupId>" + GROUP +
"</groupId><artifactId>" + PROBE + "</artifactId><version>"
+ + version + "</version>" + inheritance + "<executions>" +
executions + "</executions></plugin></plugins></build>";
+ }
+
+ private String execution(String id, String phase, String goals, String
extra) {
+ return "<execution><id>" + id + "</id>" + (phase == null ? "" :
"<phase>" + phase + "</phase>")
+ + extra + "<goals><goal>" + goals +
"</goal></goals></execution>";
+ }
+}
diff --git
a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorTest.java
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorTest.java
new file mode 100644
index 0000000000..b81bceb36a
--- /dev/null
+++
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13763ConcurrentAggregatorTest.java
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.it;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class MavenITmng13763ConcurrentAggregatorTest extends
AbstractMavenIntegrationTestCase {
+
+ @Test
+ public void testAggregatorWaitsForChildren() throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+
+ Verifier verifier = newCleanVerifier(testDir.resolve("reactor"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("verify");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ assertEquals(
+ "a=true b=true aa=true",
+
Files.readString(testDir.resolve("reactor/target/aggregate-observed.txt"))
+ .trim());
+
assertFalse(Files.exists(testDir.resolve("reactor/a/target/aggregate-observed.txt")));
+
assertFalse(Files.exists(testDir.resolve("reactor/a/aa/target/aggregate-observed.txt")));
+
assertFalse(Files.exists(testDir.resolve("reactor/b/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testAggregatorDoesNotRunAfterChildFailure() throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+
+ Verifier verifier = newCleanVerifier(testDir.resolve("reactor"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("--fail-at-end");
+ verifier.addCliArgument("-DfailModule=b");
+ verifier.addCliArgument("package");
+ assertThrows(VerificationException.class, verifier::execute);
+
+
assertFalse(Files.exists(testDir.resolve("reactor/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testChildProfileAggregatorIsPreserved() throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+
+ Verifier verifier = newCleanVerifier(testDir.resolve("reactor"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("-Pchild-aggregate");
+ verifier.addCliArgument("-DexpectChildAggregator=true");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ assertEquals(
+ "a=true b=true aa=true",
+
Files.readString(testDir.resolve("reactor/target/aggregate-observed.txt"))
+ .trim());
+ assertEquals(
+ "a=false b=false aa=true",
+
Files.readString(testDir.resolve("reactor/a/target/aggregate-observed.txt"))
+ .trim());
+ }
+
+ @Test
+ public void testPartialBuildPreservesInheritedAggregator() throws
Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+
+ Verifier verifier = newCleanVerifier(testDir.resolve("reactor"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("-pl");
+ verifier.addCliArgument(":a");
+ verifier.addCliArgument("-DrequireOwnTouch=true");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+
assertTrue(Files.exists(testDir.resolve("reactor/a/target/aggregate-observed.txt")));
+
assertTrue(Files.exists(testDir.resolve("reactor/a/target/touched.txt")));
+
assertFalse(Files.exists(testDir.resolve("reactor/target/aggregate-observed.txt")));
+
assertFalse(Files.exists(testDir.resolve("reactor/b/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testManagedAggregatorRunsInModules() throws Exception {
+ verifyManagedAggregator(null);
+ }
+
+ @Test
+ public void testManagedAggregatorWithNoninheritedPlugin() throws Exception
{
+ verifyManagedAggregator("noninherited-plugin");
+ }
+
+ @Test
+ public void testManagedAggregatorWithNoninheritedExecution() throws
Exception {
+ verifyManagedAggregator("noninherited-execution");
+ }
+
+ private void verifyManagedAggregator(String profile) throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+
+ Verifier verifier = newCleanVerifier(testDir.resolve("managed"),
false);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("-DrequireOwnTouch=" + (profile == null));
+ if (profile != null) {
+ verifier.addCliArgument("-P" + profile);
+ }
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ assertEquals(profile != null,
Files.exists(testDir.resolve("managed/target/aggregate-observed.txt")));
+ assertEquals(
+ "a=false b=false aa=false",
+
Files.readString(testDir.resolve("managed/a/target/aggregate-observed.txt"))
+ .trim());
+ assertEquals(
+ "a=false b=false aa=false",
+
Files.readString(testDir.resolve("managed/b/target/aggregate-observed.txt"))
+ .trim());
+ }
+
+ private void installPlugin(Path testDir) throws Exception {
+ Verifier verifier = newVerifier(testDir.resolve("plugin"));
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ }
+
+ @Test
+ public void testSettingsProfileDoesNotActivatePomDeclaration() throws
Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+ Verifier verifier = newCleanVerifier(testDir.resolve("reactor"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("--settings=" +
testDir.resolve("settings.xml"));
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertFalse(Files.exists(testDir.resolve("reactor/a/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testInheritanceStopsAtIntermediatePlugin() throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+ Verifier verifier =
newCleanVerifier(testDir.resolve("managed-barrier"), true);
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertTrue(Files.exists(testDir.resolve("managed-barrier/a/aa/target/aggregate-observed.txt")));
+
assertFalse(Files.exists(testDir.resolve("managed-barrier/a/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testConsumerWaitsForAttachedAggregate() throws Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+ Path reactor = testDir.resolve("outputs");
+ Verifier verifier = newVerifier(reactor);
+ for (String path : new String[] {"target", "group/target",
"group/a/target", "consumer/target"}) {
+ verifier.deleteDirectory(path);
+ }
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T4");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertTrue(Files.exists(reactor.resolve("group/target/aggregate.jar")));
+ verifier.verifyTextInLog("Aggregate artifact resolved");
+ }
+
+ @Test
+ public void testAggregatorForSubprojectWithDifferentParent() throws
Exception {
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+ Verifier verifier = newVerifier(testDir.resolve("nonparent"));
+ verifier.deleteDirectory("target");
+ verifier.deleteDirectory("a/target");
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T2");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
assertTrue(Files.exists(testDir.resolve("nonparent/a/target/aggregate-observed.txt")));
+ }
+
+ @Test
+ public void testExplicitAggregatorWithInterpolatedCoordinatesAndGoal()
throws Exception {
+ verifyInterpolatedAggregator("properties");
+ }
+
+ @Test
+ public void testProfileAggregatorMergedWithAnotherGoal() throws Exception {
+ verifyInterpolatedAggregator("profile-properties");
+ }
+
+ private void verifyInterpolatedAggregator(String fixture) throws Exception
{
+ Path testDir = extractResources("mng-13763");
+ installPlugin(testDir);
+ Verifier verifier = newVerifier(testDir.resolve(fixture));
+ verifier.deleteDirectory("target");
+ verifier.deleteDirectory("a/target");
+ verifier.addCliArgument("-b");
+ verifier.addCliArgument("concurrent");
+ verifier.addCliArgument("-T1");
+ verifier.addCliArgument("package");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+ assertTrue(Files.exists(testDir.resolve(fixture +
"/a/target/aggregate-observed.txt")));
+ }
+
+ private Verifier newCleanVerifier(Path reactorDir, boolean nested) throws
IOException, VerificationException {
+ Verifier verifier = newVerifier(reactorDir);
+ for (String path : new String[] {"target", "a/target", "b/target"}) {
+ verifier.deleteDirectory(path);
+ }
+ if (nested) {
+ verifier.deleteDirectory("a/aa/target");
+ }
+ return verifier;
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/aa/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/aa/pom.xml
new file mode 100644
index 0000000000..da6288bbcc
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/aa/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>barrier-middle</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>barrier-leaf</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/pom.xml
new file mode 100644
index 0000000000..9834f03e36
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/a/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>managed-barrier</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>barrier-middle</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>aa</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/pom.xml
new file mode 100644
index 0000000000..0d889b967a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/managed-barrier/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>managed-barrier</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ </modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/managed/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed/a/pom.xml
new file mode 100644
index 0000000000..5f7e90b4ba
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/managed/a/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>managed-reactor</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>a</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>touch</id>
+ <phase>package</phase>
+ <goals><goal>touch</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/managed/b/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed/b/pom.xml
new file mode 100644
index 0000000000..fb9999b490
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/managed/b/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>managed-reactor</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>b</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>touch</id>
+ <phase>package</phase>
+ <goals><goal>touch</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/managed/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/managed/pom.xml
new file mode 100644
index 0000000000..fb4889a863
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/managed/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>managed-reactor</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ <module>b</module>
+ </modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <!-- Ordinary phase work must precede the aggregator in the
configured order. -->
+ <execution>
+ <id>touch</id>
+ <phase>package</phase>
+ <goals><goal>touch</goal></goals>
+ </execution>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <profiles>
+ <profile>
+ <id>noninherited-plugin</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>noninherited-execution</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <inherited>false</inherited>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/nonparent/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/nonparent/a/pom.xml
new file mode 100644
index 0000000000..6bf273a355
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/nonparent/a/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>nonparent-child</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/nonparent/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/nonparent/pom.xml
new file mode 100644
index 0000000000..885ad5efbb
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/nonparent/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>nonparent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <configuration>
+ <expectedAggregates>
+
<expectedAggregate>a/target/aggregate-observed.txt</expectedAggregate>
+ </expectedAggregates>
+ </configuration>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/outputs/consumer/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/outputs/consumer/pom.xml
new file mode 100644
index 0000000000..ad6e477e8f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/outputs/consumer/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>consumer</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>group</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <classifier>aggregate</classifier>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>consume</id>
+ <goals>
+ <goal>consume</goal>
+ </goals>
+ <phase>compile</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/outputs/group/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/outputs/group/a/pom.xml
new file mode 100644
index 0000000000..5b8f8417f5
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/outputs/group/a/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>output-child</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>touch</id>
+ <goals>
+ <goal>touch</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/outputs/group/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/outputs/group/pom.xml
new file mode 100644
index 0000000000..0a2cb7d796
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/outputs/group/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>group</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <inherited>false</inherited>
+ <configuration>
+ <attachArtifact>true</attachArtifact>
+ </configuration>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/outputs/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/outputs/pom.xml
new file mode 100644
index 0000000000..f9026fe63f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/outputs/pom.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>outputs</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>group</module>
+ <module>consumer</module>
+ </modules>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/plugin/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/plugin/pom.xml
new file mode 100644
index 0000000000..b6ed18b3a0
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/plugin/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <properties>
+ <maven.compiler.release>8</maven.compiler.release>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>3.9.16</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>3.9.16</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.16.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.16.0</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/AggregateMojo.java
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/AggregateMojo.java
new file mode 100644
index 0000000000..63c973b395
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/AggregateMojo.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng13763;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.jar.JarOutputStream;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+@Mojo(name = "aggregate", aggregator = true, defaultPhase =
LifecyclePhase.PACKAGE)
+public class AggregateMojo extends AbstractMojo {
+ @Parameter(defaultValue = "${project.basedir}", readonly = true, required
= true)
+ private File basedir;
+
+ @Parameter(property = "expectChildAggregator", defaultValue = "false")
+ private boolean expectChildAggregator;
+
+ @Parameter(property = "requireOwnTouch", defaultValue = "false")
+ private boolean requireOwnTouch;
+
+ @Parameter
+ private String[] expectedAggregates;
+
+ @Parameter(defaultValue = "false")
+ private boolean attachArtifact;
+
+ @Parameter(defaultValue = "aggregate-observed.txt")
+ private String markerName;
+
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
+ private MavenProject project;
+
+ @Component
+ private MavenProjectHelper projectHelper;
+
+ public void execute() throws MojoExecutionException {
+ Path root = basedir.toPath();
+ Path output = root.resolve("target").resolve(markerName);
+ boolean a = Files.exists(root.resolve("a/target/touched.txt"));
+ boolean b = Files.exists(root.resolve("b/target/touched.txt"));
+ boolean aa = Files.exists(root.resolve(
+ root.getFileName().toString().equals("a") ?
"aa/target/touched.txt" : "a/aa/target/touched.txt"));
+ if (requireOwnTouch &&
!Files.exists(root.resolve("target/touched.txt"))) {
+ throw new MojoExecutionException("The module's package goal has
not completed");
+ }
+ if (expectChildAggregator
+ && root.getFileName().toString().equals("reactor")
+ &&
!Files.exists(root.resolve("a/target/aggregate-observed.txt"))) {
+ throw new MojoExecutionException("Child aggregator has not
completed");
+ }
+ try {
+ if (expectedAggregates != null) {
+ for (String expected : expectedAggregates) {
+ if (!Files.exists(root.resolve(expected))) {
+ throw new MojoExecutionException("Missing subproject
aggregate: " + expected);
+ }
+ }
+ }
+ Files.createDirectories(output.getParent());
+ Files.write(output, ("a=" + a + " b=" + b + " aa=" +
aa).getBytes(StandardCharsets.UTF_8));
+ if (attachArtifact) {
+ File artifact = root.resolve("target/aggregate.jar").toFile();
+ try (JarOutputStream jar = new
JarOutputStream(Files.newOutputStream(artifact.toPath()))) {
+ jar.finish();
+ }
+ projectHelper.attachArtifact(project, "jar", "aggregate",
artifact);
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException("Could not write " + output, e);
+ }
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/CheckMojo.java
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/CheckMojo.java
new file mode 100644
index 0000000000..4326f0675f
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/CheckMojo.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng13763;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+@Mojo(name = "check")
+public class CheckMojo extends AbstractMojo {
+ @Parameter(defaultValue = "${project.basedir}", readonly = true, required
= true)
+ private File basedir;
+
+ @Parameter(defaultValue = "aggregate-observed.txt")
+ private String expectedMarker;
+
+ public void execute() throws MojoExecutionException {
+ if
(!Files.exists(basedir.toPath().resolve("target").resolve(expectedMarker))) {
+ throw new MojoExecutionException("Aggregate has not completed
before the following goal");
+ }
+ try {
+ Files.write(basedir.toPath().resolve("target/checked.txt"), new
byte[0]);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Could not record the following
goal", e);
+ }
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/ConsumeMojo.java
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/ConsumeMojo.java
new file mode 100644
index 0000000000..3b0bc16781
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/ConsumeMojo.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng13763;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+@Mojo(name = "consume", requiresDependencyResolution = ResolutionScope.COMPILE)
+public class ConsumeMojo extends AbstractMojo {
+ public void execute() {
+ getLog().info("Aggregate artifact resolved");
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/TouchMojo.java
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/TouchMojo.java
new file mode 100644
index 0000000000..fa728fca90
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/plugin/src/main/java/org/apache/maven/its/mng13763/TouchMojo.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.its.mng13763;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+@Mojo(name = "touch")
+public class TouchMojo extends AbstractMojo {
+ @Parameter(defaultValue = "${project.basedir}", readonly = true, required
= true)
+ private File basedir;
+
+ @Parameter(property = "failModule")
+ private String failModule;
+
+ public void execute() throws MojoExecutionException {
+ if (basedir.getName().equals(failModule)) {
+ throw new MojoExecutionException("Intentional failure in " +
failModule);
+ }
+ Path marker = basedir.toPath().resolve("target/touched.txt");
+ try {
+ Files.createDirectories(marker.getParent());
+ Files.write(marker,
basedir.getName().getBytes(StandardCharsets.UTF_8));
+ } catch (IOException e) {
+ throw new MojoExecutionException("Could not write " + marker, e);
+ }
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/profile-properties/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/profile-properties/a/pom.xml
new file mode 100644
index 0000000000..017ef5bb9d
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-13763/profile-properties/a/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>profile-properties</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>property-child</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${probeGroup}</groupId>
+ <artifactId>${probeArtifact}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>touch</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>extra</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${probeGroup}</groupId>
+ <artifactId>${probeArtifact}</artifactId>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>${probeGoal}</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/profile-properties/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/profile-properties/pom.xml
new file mode 100644
index 0000000000..66b209276a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/profile-properties/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>profile-properties</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ </modules>
+ <properties>
+ <probeGroup>org.apache.maven.its.mng13763</probeGroup>
+ <probeArtifact>aggregator-probe-maven-plugin</probeArtifact>
+ <probeGoal>aggregate</probeGoal>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/properties/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/properties/a/pom.xml
new file mode 100644
index 0000000000..a47291b38c
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/properties/a/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>properties</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>property-child</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${probeGroup}</groupId>
+ <artifactId>${probeArtifact}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>${probeGoal}</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/properties/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/properties/pom.xml
new file mode 100644
index 0000000000..bff5afa6ea
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/properties/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>properties</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>a</module>
+ </modules>
+ <properties>
+ <probeGroup>org.apache.maven.its.mng13763</probeGroup>
+ <probeArtifact>aggregator-probe-maven-plugin</probeArtifact>
+ <probeGoal>aggregate</probeGoal>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-13763/reactor/a/aa/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/reactor/a/aa/pom.xml
new file mode 100644
index 0000000000..bb2df4168f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/reactor/a/aa/pom.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>a</artifactId>
+ <version>${revision}</version>
+ </parent>
+ <artifactId>aa</artifactId>
+ <packaging>pom</packaging>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/reactor/a/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/reactor/a/pom.xml
new file mode 100644
index 0000000000..82efca621f
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/reactor/a/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>reactor</artifactId>
+ <version>${revision}</version>
+ </parent>
+ <artifactId>a</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>aa</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <configuration>
+ <expectChildAggregator>false</expectChildAggregator>
+ </configuration>
+ </execution>
+ <execution>
+ <id>touch</id>
+ <goals>
+ <goal>touch</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>child-aggregate</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>aggregate-child</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>settings-collision</id>
+ <activation>
+ <property>
+ <name>neverActivated</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/reactor/b/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/reactor/b/pom.xml
new file mode 100644
index 0000000000..e092590550
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/reactor/b/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>reactor</artifactId>
+ <version>${revision}</version>
+ </parent>
+ <artifactId>b</artifactId>
+ <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>touch</id>
+ <phase>package</phase>
+ <goals><goal>touch</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/reactor/pom.xml
b/its/core-it-suite/src/test/resources/mng-13763/reactor/pom.xml
new file mode 100644
index 0000000000..9bbc21fb66
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/reactor/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>reactor</artifactId>
+ <version>${revision}</version>
+ <packaging>pom</packaging>
+ <properties>
+ <revision>1.0-SNAPSHOT</revision>
+ </properties>
+ <modules>
+ <module>a</module>
+ <module>b</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng13763</groupId>
+ <artifactId>aggregator-probe-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <!-- Ordinary phase work must precede the aggregator in the
configured order. -->
+ <execution>
+ <id>touch</id>
+ <phase>package</phase>
+ <goals><goal>touch</goal></goals>
+ </execution>
+ <execution>
+ <id>aggregate</id>
+ <phase>package</phase>
+ <goals><goal>aggregate</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mng-13763/settings.xml
b/its/core-it-suite/src/test/resources/mng-13763/settings.xml
new file mode 100644
index 0000000000..b77c32d415
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-13763/settings.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0">
+ <profiles>
+ <profile>
+ <id>settings-collision</id>
+ <activation><activeByDefault>true</activeByDefault></activation>
+ </profile>
+ </profiles>
+</settings>