You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/06/30 18:23:41 UTC

[maven-deploy-plugin] 01/04: [MSHARED-695] - WIP - Move checksum generation from install to deploy

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MSHARED-695
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git

commit 966ec7d9e5c12115c239e6b5e0912aa0eff6e3f5
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Wed Apr 11 19:49:07 2018 +0200

    [MSHARED-695] - WIP - Move checksum generation from install to deploy
---
 pom.xml                                            |  2 +-
 .../apache/maven/plugins/deploy/DeployMojo.java    |  6 +-
 .../maven/plugins/deploy/DeployMojoTest.java       | 74 +++++++++++-----------
 3 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1e4849d..74d72c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,7 +92,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-artifact-transfer</artifactId>
-      <version>0.9.1</version>
+      <version>0.9.2-SNAPSHOT</version>
     </dependency>
     <!-- Upgrade of transitive dependency. -->
     <dependency>
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
index 812b22d..229fd47 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -36,6 +36,7 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
 import org.apache.maven.shared.project.NoFileAssignedException;
 import org.apache.maven.shared.project.deploy.ProjectDeployer;
 import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
@@ -144,7 +145,6 @@ public class DeployMojo
             // @formatter:off
             ProjectDeployerRequest pdr = new ProjectDeployerRequest()
                 .setProject( project )
-                .setUpdateReleaseInfo( isUpdateReleaseInfo() )
                 .setRetryFailedDeploymentCount( getRetryFailedDeploymentCount() )
                 .setAltReleaseDeploymentRepository( altReleaseDeploymentRepository )
                 .setAltSnapshotDeploymentRepository( altSnapshotDeploymentRepository )
@@ -196,6 +196,10 @@ public class DeployMojo
         {
             throw new MojoExecutionException( "NoFileAssignedException", e );
         }
+        catch ( ArtifactDeployerException e )
+        {
+            throw new MojoExecutionException( "ArtifactDeployerException", e );
+        }
 
     }
 
diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
index 4db5b2d..9cf69eb 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java
@@ -360,43 +360,43 @@ public class DeployMojoTest
         assertEquals( 0, getSizeOfExpectedFiles( fileList, expectedFiles ) );    
     }
 
-    public void testUpdateReleaseParamSetToTrue()
-        throws Exception
-    {
-        File testPom = new File( getBasedir(),
-                                 "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
-        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
-        
-        MockitoAnnotations.initMocks( this );
-        
-        assertNotNull( mojo );
-        
-        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
-        when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
-        MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
-        repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( LOCAL_REPO ) );
-        when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession );
-        
-        boolean updateReleaseInfo = (Boolean) getVariableValueFromObject(mojo, "updateReleaseInfo");
-        
-        assertTrue( updateReleaseInfo );
-        
-        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
-
-        setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
-
-        artifact = (DeployArtifactStub) project.getArtifact();
-        
-        artifact.setFile( testPom );
-        
-        ArtifactRepositoryStub repo = getRepoStub( mojo );
-        
-        repo.setAppendToUrl( "basic-deploy-updateReleaseParam" );        
-        
-        mojo.execute();
-        
-        assertTrue( artifact.isRelease() );
-    }
+//    public void testUpdateReleaseParamSetToTrue()
+//        throws Exception
+//    {
+//        File testPom = new File( getBasedir(),
+//                                 "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
+//        mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
+//        
+//        MockitoAnnotations.initMocks( this );
+//        
+//        assertNotNull( mojo );
+//        
+//        ProjectBuildingRequest buildingRequest = mock ( ProjectBuildingRequest.class );
+//        when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );
+//        MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
+//        repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( LOCAL_REPO ) );
+//        when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession );
+//        
+//        boolean updateReleaseInfo = (Boolean) getVariableValueFromObject(mojo, "updateReleaseInfo");
+//        
+//        assertTrue( updateReleaseInfo );
+//        
+//        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
+//
+//        setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) );
+//
+//        artifact = (DeployArtifactStub) project.getArtifact();
+//        
+//        artifact.setFile( testPom );
+//        
+//        ArtifactRepositoryStub repo = getRepoStub( mojo );
+//        
+//        repo.setAppendToUrl( "basic-deploy-updateReleaseParam" );        
+//        
+//        mojo.execute();
+//        
+//        assertTrue( artifact.isRelease() );
+//    }
 
     public void testDeployIfArtifactFileIsNull()
         throws Exception