Skip to content

Commit

Permalink
Ability to skip project collection
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 27, 2024
1 parent 30731f1 commit 6ab7d6e
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ public abstract class AbstractInvokerMojo extends AbstractMojo {
@Parameter(defaultValue = "true")
private boolean cloneClean;

@Parameter
private List<String> collectedProjects;

/**
* A single POM to build, skipping any scanning parameters and behavior.
*
Expand Down Expand Up @@ -802,11 +805,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {

handleScriptRunnerWithScriptClassPath();

Collection<String> collectedProjects = new LinkedHashSet<>();
for (BuildJob buildJob : buildJobs) {
collectProjects(projectsDirectory, buildJob.getProject(), collectedProjects, true);
}

File projectsDir = projectsDirectory;

if (cloneProjectsTo == null && "maven-plugin".equals(project.getPackaging())) {
Expand All @@ -826,6 +824,13 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

if (cloneProjectsTo != null) {
Collection<String> collectedProjects = this.collectedProjects;
if (collectedProjects == null) {
collectedProjects = new LinkedHashSet<>();
for (BuildJob buildJob : buildJobs) {
collectProjects(projectsDirectory, buildJob.getProject(), collectedProjects, true);
}
}
cloneProjects(collectedProjects);
addMissingDotMvnDirectory(cloneProjectsTo, buildJobs);
projectsDir = cloneProjectsTo;
Expand Down Expand Up @@ -1088,7 +1093,7 @@ private boolean isNotEmpty(String s) {
*
* @param projectPaths The paths to the projects to clone, relative to the projects directory, must not be
* <code>null</code> nor contain <code>null</code> elements.
* @throws org.apache.maven.plugin.MojoExecutionException If the the projects could not be copied/filtered.
* @throws org.apache.maven.plugin.MojoExecutionException If the projects could not be copied/filtered.
*/
private void cloneProjects(Collection<String> projectPaths) throws MojoExecutionException {
if (!cloneProjectsTo.mkdirs() && cloneClean) {
Expand Down

0 comments on commit 6ab7d6e

Please # to comment.