Created
May 15, 2019 20:58
-
-
Save robinhowlett/1d1f6a98cbf611cdc4dc0ccdd542c354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* When building with multiple threads, reaching the last project doesn't have to mean that all projects are ready | |
* to be deployed | |
*/ | |
private static final AtomicInteger readyProjectsCounter = new AtomicInteger(); | |
... | |
public void execute() | |
throws MojoExecutionException, MojoFailureException { | |
boolean addedDeployRequest = false; | |
if (skip) { | |
getLog().info("Skipping artifact deployment"); | |
} else { | |
failIfOffline(); | |
DeployRequest currentExecutionDeployRequest = | |
new DeployRequest().setProject(project).setUpdateReleaseInfo(isUpdateReleaseInfo()).setRetryFailedDeploymentCount(getRetryFailedDeploymentCount()).setAltReleaseDeploymentRepository(altReleaseDeploymentRepository).setAltSnapshotDeploymentRepository(altSnapshotDeploymentRepository).setAltDeploymentRepository(altDeploymentRepository); | |
if (!deployAtEnd) { | |
deployProject(currentExecutionDeployRequest); | |
} else { | |
deployRequests.add(currentExecutionDeployRequest); | |
addedDeployRequest = true; | |
} | |
} | |
boolean projectsReady = readyProjectsCounter.incrementAndGet() == reactorProjects.size(); | |
if (projectsReady) { | |
synchronized (deployRequests) { | |
while (!deployRequests.isEmpty()) { | |
deployProject(deployRequests.remove(0)); | |
} | |
} | |
} else if (addedDeployRequest) { | |
getLog().info("Deploying " + project.getGroupId() + ":" + project.getArtifactId() + ":" | |
+ project.getVersion() + " at end"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment