michael-o commented on code in PR #25:
URL: https://github.com/apache/maven-deploy-plugin/pull/25#discussion_r902258110


##########
src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java:
##########
@@ -137,12 +135,6 @@
     @Parameter( property = "maven.deploy.skip", defaultValue = "false" )
     private String skip = Boolean.FALSE.toString();

Review Comment:
   Wow, why is that a string :-D



##########
src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java:
##########
@@ -116,4 +120,88 @@ protected void warnIfAffectedPackagingAndMaven( final 
String packaging )
             }
         }
     }
+
+    private RemoteRepository getRemoteRepository( ArtifactRepository 
remoteRepository )
+    {
+        RemoteRepository aetherRepo = RepositoryUtils.toRepo( remoteRepository 
);
+
+        if ( aetherRepo.getAuthentication() == null || aetherRepo.getProxy() 
== null )
+        {
+            RemoteRepository.Builder builder = new RemoteRepository.Builder( 
aetherRepo );
+
+            if ( aetherRepo.getAuthentication() == null )
+            {
+                builder.setAuthentication( 
session.getRepositorySession().getAuthenticationSelector()
+                        .getAuthentication( aetherRepo ) );
+            }
+
+            if ( aetherRepo.getProxy() == null )
+            {
+                builder.setProxy( 
session.getRepositorySession().getProxySelector().getProxy( aetherRepo ) );
+            }
+
+            aetherRepo = builder.build();
+        }
+
+        return aetherRepo;
+    }
+
+    protected DeployRequest deployRequest( ArtifactRepository repository, 
List<Artifact> artifacts )
+    {
+        DeployRequest deployRequest = new DeployRequest();
+        deployRequest.setRepository( getRemoteRepository( repository ) );
+        for ( Artifact artifact : artifacts )
+        {
+            org.eclipse.aether.artifact.Artifact aetherArtifact = 
RepositoryUtils.toArtifact( artifact );
+            deployRequest.addArtifact( aetherArtifact );
+
+            for ( ArtifactMetadata metadata : artifact.getMetadataList() )
+            {
+                if ( metadata instanceof ProjectArtifactMetadata )
+                {
+                    org.eclipse.aether.artifact.Artifact pomArtifact = new 
SubArtifact( aetherArtifact, "", "pom" );
+                    pomArtifact = pomArtifact.setFile( ( 
(ProjectArtifactMetadata) metadata ).getFile() );
+                    deployRequest.addArtifact( pomArtifact );
+                }
+            }
+        }
+        return deployRequest;
+    }
+
+    protected void deploy( DeployRequest deployRequest ) throws 
MojoExecutionException
+    {
+        int retryFailedDeploymentCounter = Math.max( 1, Math.min( 10, 
retryFailedDeploymentCount ) );
+        DeploymentException exception = null;
+        for ( int count = 0; count < retryFailedDeploymentCounter; count++ )
+        {
+            try
+            {
+                if ( count > 0 )
+                {
+                    getLog().info( "Retrying deployment attempt " + ( count + 
1 ) + " of "
+                            + retryFailedDeploymentCounter );
+                }
+
+                repositorySystem.deploy( session.getRepositorySession(), 
deployRequest );
+                exception = null;
+                break;
+            }
+            catch ( DeploymentException e )
+            {
+                if ( count + 1 < retryFailedDeploymentCounter )
+                {
+                    getLog().warn( "Encountered issue during deployment: " + 
e.getLocalizedMessage() );
+                    getLog().debug( e.getMessage() );

Review Comment:
   Honestly, just use warn with `e` and that's it. No brain magic.



##########
src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java:
##########
@@ -116,4 +120,88 @@ protected void warnIfAffectedPackagingAndMaven( final 
String packaging )
             }
         }
     }
+
+    private RemoteRepository getRemoteRepository( ArtifactRepository 
remoteRepository )
+    {
+        RemoteRepository aetherRepo = RepositoryUtils.toRepo( remoteRepository 
);

Review Comment:
   Should we still use the old term `aether`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to