use of org.apache.maven.shared.project.deploy.ProjectDeployerRequest in project maven-plugins by apache.
the class DeployMojoTest method testAltSnapshotDeploymentRepository.
public void testAltSnapshotDeploymentRepository() throws Exception {
DeployMojo mojo = spy(new DeployMojo());
ArtifactRepository repository = mock(ArtifactRepository.class);
when(mojo.createDeploymentArtifactRepository("altSnapshotDeploymentRepository", "http://localhost")).thenReturn(repository);
project.setVersion("1.0-SNAPSHOT");
ProjectDeployerRequest pdr = new ProjectDeployerRequest().setProject(project).setAltDeploymentRepository("altSnapshotDeploymentRepository::http://localhost");
assertEquals(repository, mojo.getDeploymentRepository(pdr));
}
use of org.apache.maven.shared.project.deploy.ProjectDeployerRequest in project maven-plugins by apache.
the class DeployMojoTest method testAltReleaseDeploymentRepository.
public void testAltReleaseDeploymentRepository() throws Exception {
DeployMojo mojo = spy(new DeployMojo());
ArtifactRepository repository = mock(ArtifactRepository.class);
when(mojo.createDeploymentArtifactRepository("altReleaseDeploymentRepository", "http://localhost")).thenReturn(repository);
project.setVersion("1.0");
ProjectDeployerRequest pdr = new ProjectDeployerRequest().setProject(project).setAltReleaseDeploymentRepository("altReleaseDeploymentRepository::http://localhost");
assertEquals(repository, mojo.getDeploymentRepository(pdr));
}
use of org.apache.maven.shared.project.deploy.ProjectDeployerRequest in project maven-plugins by apache.
the class DeployMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
boolean addedDeployRequest = false;
if (skip) {
getLog().info("Skipping artifact deployment");
} else {
failIfOffline();
// CHECKSTYLE_OFF: LineLength
// @formatter:off
ProjectDeployerRequest pdr = new ProjectDeployerRequest().setProject(project).setUpdateReleaseInfo(isUpdateReleaseInfo()).setRetryFailedDeploymentCount(getRetryFailedDeploymentCount()).setAltReleaseDeploymentRepository(altReleaseDeploymentRepository).setAltSnapshotDeploymentRepository(altSnapshotDeploymentRepository).setAltDeploymentRepository(altDeploymentRepository);
// @formatter:on
// CHECKSTYLE_ON: LineLength
ArtifactRepository repo = getDeploymentRepository(pdr);
if (!deployAtEnd) {
deployProject(getSession().getProjectBuildingRequest(), pdr, repo);
} else {
DEPLOYREQUESTS.add(pdr);
addedDeployRequest = true;
}
}
boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
if (projectsReady) {
synchronized (DEPLOYREQUESTS) {
while (!DEPLOYREQUESTS.isEmpty()) {
ArtifactRepository repo = getDeploymentRepository(DEPLOYREQUESTS.get(0));
deployProject(getSession().getProjectBuildingRequest(), DEPLOYREQUESTS.remove(0), repo);
}
}
} else if (addedDeployRequest) {
getLog().info("Deploying " + project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() + " at end");
}
}
Aggregations