Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,27 @@ public List<MavenProject> executeForkedExecutions(
for (Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet()) {
String projectId = fork.getKey();

int index = projectIndex.getIndices().get(projectId);
Integer idx = projectIndex.getIndices().get(projectId);
if (idx == null) {
throw new LifecycleExecutionException(
"Forked execution references project '" + projectId
+ "' which is not in the reactor. This can happen with parallel builds"
+ " (-T) or when extensions modify the session projects.",
mojoExecution,
project);
}
int index = idx;

MavenProject forkedProject = projectIndex.getProjects().get(projectId);
if (forkedProject == null) {
throw new LifecycleExecutionException(
"Forked execution references project '" + projectId
+ "' which is not in the reactor (no project instance). This can happen"
+ " with parallel builds (-T) or when extensions modify the session"
+ " projects.",
mojoExecution,
project);
}

forkedProjects.add(forkedProject);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package org.apache.maven.lifecycle.internal;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
import org.apache.maven.project.MavenProject;
Expand All @@ -43,8 +43,8 @@ public final class ProjectIndex {
private final Map<String, Integer> indices;

public ProjectIndex(List<MavenProject> projects) {
this.projects = new HashMap<>(projects.size() * 2);
this.indices = new HashMap<>(projects.size() * 2);
this.projects = new ConcurrentHashMap<>(projects.size() * 2);
this.indices = new ConcurrentHashMap<>(projects.size() * 2);

for (int i = 0; i < projects.size(); i++) {
MavenProject project = projects.get(i);
Expand Down
Loading