You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/11/07 19:11:19 UTC

[maven-install-plugin] branch MINSTALL-185 created (now 9dcdf04)

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

sjaranowski pushed a change to branch MINSTALL-185
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git


      at 9dcdf04  [MINSTALL-185] Install all artifacts in one request

This branch includes the following new commits:

     new 9dcdf04  [MINSTALL-185] Install all artifacts in one request

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-install-plugin] 01/01: [MINSTALL-185] Install all artifacts in one request

Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch MINSTALL-185
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git

commit 9dcdf0414cc63a31edb553533cc04c18898db4c1
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Nov 7 20:10:43 2022 +0100

    [MINSTALL-185] Install all artifacts in one request
---
 .../apache/maven/plugins/install/InstallMojo.java    | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/install/InstallMojo.java b/src/main/java/org/apache/maven/plugins/install/InstallMojo.java
index d564ff8..299e148 100644
--- a/src/main/java/org/apache/maven/plugins/install/InstallMojo.java
+++ b/src/main/java/org/apache/maven/plugins/install/InstallMojo.java
@@ -122,7 +122,9 @@ public class InstallMojo
         {
             if ( !installAtEnd )
             {
-                installProject( project );
+                InstallRequest request = new InstallRequest();
+                processProject( project, request );
+                installProject( request );
                 putState( State.INSTALLED );
             }
             else
@@ -137,14 +139,16 @@ public class InstallMojo
 
         if ( allProjectsMarked( allProjectsUsingPlugin ) )
         {
+            InstallRequest request = new InstallRequest();
             for ( MavenProject reactorProject : allProjectsUsingPlugin )
             {
                 State state = getState( reactorProject );
                 if ( state == State.TO_BE_INSTALLED )
                 {
-                    installProject( reactorProject );
+                    processProject( reactorProject, request );
                 }
             }
+            installProject( request );
         }
     }
 
@@ -190,11 +194,11 @@ public class InstallMojo
         return false;
     }
 
-    private void installProject( MavenProject project ) throws MojoExecutionException
+    private void installProject( InstallRequest request ) throws MojoExecutionException
     {
         try
         {
-            repositorySystem.install( session.getRepositorySession(), processProject( project ) );
+            repositorySystem.install( session.getRepositorySession(), request );
         }
         catch ( InstallationException e )
         {
@@ -203,14 +207,12 @@ public class InstallMojo
     }
 
     /**
-     * Processes passed in {@link MavenProject} and produces {@link InstallRequest} out of it.
+     * Processes passed in {@link MavenProject} and prepares content of {@link InstallRequest} out of it.
      *
      * @throws MojoExecutionException if project is badly set up.
      */
-    private InstallRequest processProject( MavenProject project ) throws MojoExecutionException
+    private void processProject( MavenProject project, InstallRequest request ) throws MojoExecutionException
     {
-        InstallRequest request = new InstallRequest();
-
         if ( isFile( project.getFile() ) )
         {
             request.addArtifact( RepositoryUtils.toArtifact( new ProjectArtifact( project ) ) );
@@ -245,8 +247,6 @@ public class InstallMojo
             getLog().debug( "Attaching for install: " + attached.getId() );
             request.addArtifact( RepositoryUtils.toArtifact( attached ) );
         }
-
-        return request;
     }
 
     private boolean isFile( File file )