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

[MINVOKER-374] Ability to skip project collection #265

Merged
merged 2 commits into from
Dec 5, 2024
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 @@ -217,6 +217,9 @@ public abstract class AbstractInvokerMojo extends AbstractMojo {
@Parameter(defaultValue = "true")
private boolean cloneClean;

@Parameter
private List<String> collectedProjects;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description and since tag will be appreciated

/**
* 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