Author: rfscholte Date: Fri Oct 11 16:38:02 2013 New Revision: 1531347 URL: http://svn.apache.org/r1531347 Log: [MDEPLOY-170] Plugin configuration on module level is ignored when deployAtEnd
Added: maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/pom.xml maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/pom.xml maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/pom.xml maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/verify.groovy maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployRequest.java Modified: maven/plugins/trunk/maven-deploy-plugin/pom.xml maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java Modified: maven/plugins/trunk/maven-deploy-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/pom.xml?rev=1531347&r1=1531346&r2=1531347&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-deploy-plugin/pom.xml Fri Oct 11 16:38:02 2013 @@ -30,7 +30,7 @@ under the License. </parent> <artifactId>maven-deploy-plugin</artifactId> - <version>2.9-SNAPSHOT</version> + <version>2.8.1-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>Apache Maven Deploy Plugin</name> Added: maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/pom.xml?rev=1531347&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/pom.xml (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module1/pom.xml Fri Oct 11 16:38:02 2013 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.its.mdeploy-170</groupId> + <artifactId>configperproject</artifactId> + <version>1.0</version> + </parent> + <artifactId>module1</artifactId> + +</project> Added: maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/pom.xml?rev=1531347&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/pom.xml (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/module2/pom.xml Fri Oct 11 16:38:02 2013 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.its.mdeploy-170</groupId> + <artifactId>configperproject</artifactId> + <version>1.0</version> + </parent> + <artifactId>module2</artifactId> + <packaging>pom</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/pom.xml?rev=1531347&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/pom.xml (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/pom.xml Fri Oct 11 16:38:02 2013 @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.its.mdeploy-170</groupId> + <artifactId>configperproject</artifactId> + <version>1.0</version> + <packaging>pom</packaging> + + <description> + Tests deployment at end with with different plugin configurations. + </description> + + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> + + <distributionManagement> + <repository> + <id>it</id> + <url>file:///${basedir}/target/repo</url> + <uniqueVersion>false</uniqueVersion> + </repository> + </distributionManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <deployAtEnd>true</deployAtEnd> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>2.0.4</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.3.1</version> + </plugin> + </plugins> + </build> + + <modules> + <module>module1</module> + <module>module2</module> + </modules> +</project> Added: maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/verify.groovy?rev=1531347&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/verify.groovy (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/MDEPLOY-170_deploy-at-end-configperproject/verify.groovy Fri Oct 11 16:38:02 2013 @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +assert new File( basedir, "target/repo/org/apache/maven/its/mdeploy-170/configperproject/1.0/configperproject-1.0.pom" ).exists() +assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-170/module1/1.0/module1-1.0.pom" ).exists() +assert !( new File( basedir, "module2/target/repo/org/apache/maven/its/mdeploy-170/module2/1.0/module2-1.0.pom" ).exists() ) Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java?rev=1531347&r1=1531346&r2=1531347&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java Fri Oct 11 16:38:02 2013 @@ -134,6 +134,16 @@ public abstract class AbstractDeployMojo return layout; } + boolean isUpdateReleaseInfo() + { + return updateReleaseInfo; + } + + int getRetryFailedDeploymentCount() + { + return retryFailedDeploymentCount; + } + /** * Deploy an artifact from a particular file. * @@ -141,21 +151,22 @@ public abstract class AbstractDeployMojo * @param artifact the artifact definition * @param deploymentRepository the repository to deploy to * @param localRepository the local repository to install into + * @param retryFailedDeploymentCount TODO * @throws ArtifactDeploymentException if an error occurred deploying the artifact */ protected void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) + ArtifactRepository localRepository, int retryFailedDeploymentCount ) throws ArtifactDeploymentException { - int retryFailedDeploymentCount = Math.max( 1, Math.min( 10, this.retryFailedDeploymentCount ) ); + int retryFailedDeploymentCounter = Math.max( 1, Math.min( 10, retryFailedDeploymentCount ) ); ArtifactDeploymentException exception = null; - for ( int count = 0; count < retryFailedDeploymentCount; count++ ) + for ( int count = 0; count < retryFailedDeploymentCounter; count++ ) { try { if ( count > 0 ) { - getLog().info( "Retrying deployment attempt " + ( count + 1 ) + " of " + retryFailedDeploymentCount ); + getLog().info( "Retrying deployment attempt " + ( count + 1 ) + " of " + retryFailedDeploymentCounter ); } getDeployer().deploy( source, artifact, deploymentRepository, localRepository ); exception = null; @@ -163,7 +174,7 @@ public abstract class AbstractDeployMojo } catch ( ArtifactDeploymentException e ) { - if ( count + 1 < retryFailedDeploymentCount ) + if ( count + 1 < retryFailedDeploymentCounter ) { getLog().warn( "Encountered issue during deployment: " + e.getLocalizedMessage() ); getLog().debug( e ); Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java?rev=1531347&r1=1531346&r2=1531347&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java Fri Oct 11 16:38:02 2013 @@ -273,7 +273,7 @@ public class DeployFileMojo try { - deploy( file, artifact, deploymentRepository, getLocalRepository() ); + deploy( file, artifact, deploymentRepository, getLocalRepository(), getRetryFailedDeploymentCount() ); } catch ( ArtifactDeploymentException e ) { @@ -379,7 +379,7 @@ public class DeployFileMojo { try { - deploy( attached.getFile(), attached, deploymentRepository, getLocalRepository() ); + deploy( attached.getFile(), attached, deploymentRepository, getLocalRepository(), getRetryFailedDeploymentCount() ); } catch ( ArtifactDeploymentException e ) { Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=1531347&r1=1531346&r2=1531347&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java Fri Oct 11 16:38:02 2013 @@ -35,6 +35,8 @@ import org.apache.maven.project.MavenPro import org.apache.maven.project.artifact.ProjectArtifactMetadata; import java.io.File; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; @@ -58,6 +60,9 @@ public class DeployMojo * 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(); + + private static final List<DeployRequest> deployRequests = + Collections.synchronizedList( new ArrayList<DeployRequest>() ); /** */ @@ -146,45 +151,60 @@ public class DeployMojo public void execute() throws MojoExecutionException, MojoFailureException { - int projectsReady = readyProjectsCounter.incrementAndGet(); + boolean projectsReady = readyProjectsCounter.incrementAndGet() == reactorProjects.size(); if ( skip ) { getLog().info( "Skipping artifact deployment" ); - return; } + else + { + failIfOffline(); - failIfOffline(); + DeployRequest currentExecutionDeployRequest = + new DeployRequest().setProject( project ).setUpdateReleaseInfo( isUpdateReleaseInfo() ).setRetryFailedDeploymentCount( getRetryFailedDeploymentCount() ).setAltReleaseDeploymentRepository( altReleaseDeploymentRepository ).setAltSnapshotDeploymentRepository( altSnapshotDeploymentRepository ).setAltDeploymentRepository( altDeploymentRepository ); - if ( !deployAtEnd ) - { - deployProject( project ); - } - else if ( projectsReady < reactorProjects.size() ) - { - getLog().info( "Deploying " + project.getGroupId() + ":" + project.getArtifactId() + ":" - + project.getVersion() + " at end" ); + if ( !deployAtEnd ) + { + deployProject( currentExecutionDeployRequest ); + } + else + { + deployRequests.add( currentExecutionDeployRequest ); + if ( !projectsReady ) + { + getLog().info( "Deploying " + project.getGroupId() + ":" + project.getArtifactId() + ":" + + project.getVersion() + " at end" ); + } + } } - else + + if ( projectsReady ) { - for ( MavenProject reactorProject : reactorProjects ) + synchronized ( deployRequests ) { - deployProject( reactorProject ); + while( !deployRequests.isEmpty() ) + { + deployProject( deployRequests.remove( 0 ) ); + } } } } - private void deployProject( MavenProject project ) + private void deployProject( DeployRequest request ) throws MojoExecutionException, MojoFailureException { - Artifact artifact = project.getArtifact(); - String packaging = project.getPackaging(); - File pomFile = project.getFile(); + Artifact artifact = request.getProject().getArtifact(); + String packaging = request.getProject().getPackaging(); + File pomFile = request.getProject().getFile(); @SuppressWarnings( "unchecked" ) - List<Artifact> attachedArtifacts = project.getAttachedArtifacts(); + List<Artifact> attachedArtifacts = request.getProject().getAttachedArtifacts(); - ArtifactRepository repo = getDeploymentRepository( project ); + ArtifactRepository repo = + getDeploymentRepository( request.getProject(), request.getAltDeploymentRepository(), + request.getAltReleaseDeploymentRepository(), + request.getAltSnapshotDeploymentRepository() ); String protocol = repo.getProtocol(); @@ -206,16 +226,18 @@ public class DeployMojo artifact.addMetadata( metadata ); } - if ( updateReleaseInfo ) + if ( request.isUpdateReleaseInfo() ) { artifact.setRelease( true ); } + + int retryFailedDeploymentCount = request.getRetryFailedDeploymentCount(); try { if ( isPomArtifact ) { - deploy( pomFile, artifact, repo, getLocalRepository() ); + deploy( pomFile, artifact, repo, getLocalRepository(), retryFailedDeploymentCount ); } else { @@ -223,7 +245,7 @@ public class DeployMojo if ( file != null && file.isFile() ) { - deploy( file, artifact, repo, getLocalRepository() ); + deploy( file, artifact, repo, getLocalRepository(), retryFailedDeploymentCount ); } else if ( !attachedArtifacts.isEmpty() ) { @@ -233,12 +255,12 @@ public class DeployMojo artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion() ); pomArtifact.setFile( pomFile ); - if ( updateReleaseInfo ) + if ( request.isUpdateReleaseInfo() ) { pomArtifact.setRelease( true ); } - deploy( pomFile, pomArtifact, repo, getLocalRepository() ); + deploy( pomFile, pomArtifact, repo, getLocalRepository(), retryFailedDeploymentCount ); // propagate the timestamped version to the main artifact for the attached artifacts to pick it up artifact.setResolvedVersion( pomArtifact.getVersion() ); @@ -252,7 +274,7 @@ public class DeployMojo for ( Artifact attached : attachedArtifacts ) { - deploy( attached.getFile(), attached, repo, getLocalRepository() ); + deploy( attached.getFile(), attached, repo, getLocalRepository(), retryFailedDeploymentCount ); } } catch ( ArtifactDeploymentException e ) @@ -261,7 +283,7 @@ public class DeployMojo } } - ArtifactRepository getDeploymentRepository( MavenProject project ) + ArtifactRepository getDeploymentRepository( MavenProject project, String altDeploymentRepository, String altReleaseDeploymentRepository, String altSnapshotDeploymentRepository ) throws MojoExecutionException, MojoFailureException { ArtifactRepository repo = null; Added: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployRequest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployRequest.java?rev=1531347&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployRequest.java (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployRequest.java Fri Oct 11 16:38:02 2013 @@ -0,0 +1,149 @@ +package org.apache.maven.plugin.deploy; + +import org.apache.maven.project.MavenProject; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @author Robert Scholte + * @since 2.8.1 + */ +class DeployRequest +{ + + // From AbstractDeployMojo + + private boolean updateReleaseInfo; + + private int retryFailedDeploymentCount; + + // From DeployMojo + + private MavenProject project; + + private String altDeploymentRepository; + + private String altSnapshotDeploymentRepository; + + private String altReleaseDeploymentRepository; + + /** + * @return the updateReleaseInfo + */ + public boolean isUpdateReleaseInfo() + { + return updateReleaseInfo; + } + + /** + * @param updateReleaseInfo the updateReleaseInfo to set + */ + public DeployRequest setUpdateReleaseInfo( boolean updateReleaseInfo ) + { + this.updateReleaseInfo = updateReleaseInfo; + return this; + } + + /** + * @return the retryFailedDeploymentCount + */ + public int getRetryFailedDeploymentCount() + { + return retryFailedDeploymentCount; + } + + /** + * @param retryFailedDeploymentCount the retryFailedDeploymentCount to set + */ + public DeployRequest setRetryFailedDeploymentCount( int retryFailedDeploymentCount ) + { + this.retryFailedDeploymentCount = retryFailedDeploymentCount; + return this; + } + + /** + * @return the project + */ + public MavenProject getProject() + { + return project; + } + + /** + * @param project the project to set + */ + public DeployRequest setProject( MavenProject project ) + { + this.project = project; + return this; + } + + /** + * @return the altDeploymentRepository + */ + public String getAltDeploymentRepository() + { + return altDeploymentRepository; + } + + /** + * @param altDeploymentRepository the altDeploymentRepository to set + */ + public DeployRequest setAltDeploymentRepository( String altDeploymentRepository ) + { + this.altDeploymentRepository = altDeploymentRepository; + return this; + } + + /** + * @return the altSnapshotDeploymentRepository + */ + public String getAltSnapshotDeploymentRepository() + { + return altSnapshotDeploymentRepository; + } + + /** + * @param altSnapshotDeploymentRepository the altSnapshotDeploymentRepository to set + */ + public DeployRequest setAltSnapshotDeploymentRepository( String altSnapshotDeploymentRepository ) + { + this.altSnapshotDeploymentRepository = altSnapshotDeploymentRepository; + return this; + } + + /** + * @return the altReleaseDeploymentRepository + */ + public String getAltReleaseDeploymentRepository() + { + return altReleaseDeploymentRepository; + } + + /** + * @param altReleaseDeploymentRepository the altReleaseDeploymentRepository to set + */ + public DeployRequest setAltReleaseDeploymentRepository( String altReleaseDeploymentRepository ) + { + this.altReleaseDeploymentRepository = altReleaseDeploymentRepository; + return this; + } +} Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java?rev=1531347&r1=1531346&r2=1531347&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java Fri Oct 11 16:38:02 2013 @@ -122,6 +122,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = ( DeployArtifactStub ) project.getArtifact(); String packaging = project.getPackaging(); @@ -223,6 +225,8 @@ public class DeployMojoTest assertTrue( file.exists() ); MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); artifact = (DeployArtifactStub) project.getArtifact(); @@ -276,6 +280,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = (DeployArtifactStub) project.getArtifact(); artifact.setArtifactHandlerExtension( packaging ); @@ -334,6 +340,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = (DeployArtifactStub) project.getArtifact(); artifact.setFile( testPom ); @@ -359,6 +367,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = (DeployArtifactStub) project.getArtifact(); artifact.setFile( null ); @@ -390,6 +400,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = (DeployArtifactStub) project.getArtifact(); File file = new File( getBasedir(), @@ -505,6 +517,8 @@ public class DeployMojoTest MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); + artifact = (DeployArtifactStub) project.getArtifact(); artifact.setFile( file ); @@ -538,8 +552,6 @@ public class DeployMojoTest { DeployMojo mojo = new DeployMojo(); - setVariableValueToObject( mojo, "altSnapshotDeploymentRepository", "altSnapshotDeploymentRepository::default::http://localhost" ); - ArtifactRepositoryLayout repositoryLayout = mock( ArtifactRepositoryLayout.class ); setVariableValueToObject( mojo, "repositoryLayouts", Collections.singletonMap( "default", repositoryLayout ) ); @@ -550,15 +562,13 @@ public class DeployMojoTest project.setVersion( "1.0-SNAPSHOT" ); - assertEquals( repository, mojo.getDeploymentRepository( project ) ); + assertEquals( repository, mojo.getDeploymentRepository( project, null, null, "altSnapshotDeploymentRepository::default::http://localhost" ) ); } public void testAltReleaseDeploymentRepository() throws Exception { DeployMojo mojo = new DeployMojo(); - setVariableValueToObject( mojo, "altReleaseDeploymentRepository", "altReleaseDeploymentRepository::default::http://localhost" ); - ArtifactRepositoryLayout repositoryLayout = mock( ArtifactRepositoryLayout.class ); setVariableValueToObject( mojo, "repositoryLayouts", Collections.singletonMap( "default", repositoryLayout ) ); @@ -569,7 +579,7 @@ public class DeployMojoTest project.setVersion( "1.0" ); - assertEquals( repository, mojo.getDeploymentRepository( project ) ); + assertEquals( repository, mojo.getDeploymentRepository( project, null, "altReleaseDeploymentRepository::default::http://localhost", null ) ); }