Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.8.x] [MNG-7672] Fork should only execute the project and its submodules #970

Merged
merged 2 commits into from
Jan 30, 2023
Merged
Changes from 1 commit
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 @@ -21,6 +21,7 @@

import java.io.File;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -96,19 +97,32 @@ public static List<MavenProject> getProjects( MavenProject project, MavenSession
{
if ( aggregator )
{
return session.getProjects();
List<MavenProject> projects = new ArrayList<>();
addProjectAndSubModules( projects, project );
return projects;
}
else
{
return Collections.singletonList( project );
}
}

private static void addProjectAndSubModules( List<MavenProject> projects, MavenProject project )
{
projects.add( project );
for ( MavenProject submodule : project.getCollectedProjects() )
{
addProjectAndSubModules( projects, submodule );
}
}


public void resolveProjectDependencies( MavenProject project, Collection<String> scopesToCollect,
Collection<String> scopesToResolve, MavenSession session,
boolean aggregating, Set<Artifact> projectArtifacts )
throws LifecycleExecutionException
{

ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try
{
Expand Down