maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MNG-6411) Improve readability of project list returned when --resume-from option value is invalid
Date Fri, 18 May 2018 20:49:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-6411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16481176#comment-16481176
] 

ASF GitHub Bot commented on MNG-6411:
-------------------------------------

asfgit closed pull request #164: [MNG-6411] Improve readability of project list for resume
option.
URL: https://github.com/apache/maven/pull/164
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
index ec72e8d81d..fb7a9f4506 100644
--- a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
@@ -25,6 +25,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -311,13 +312,29 @@ else if ( StringUtils.isNotEmpty( request.getMakeBehavior() ) )
             if ( !resumed )
             {
                 throw new MavenExecutionException( "Could not find project to resume reactor
build from: " + selector
-                    + " vs " + projects, request.getPom() );
+                    + " vs " + formatProjects( projects ), request.getPom() );
             }
         }
 
         return result;
     }
 
+    private String formatProjects( List<MavenProject> projects )
+    {
+        StringBuilder projectNames = new StringBuilder();
+        Iterator<MavenProject> iterator = projects.iterator();
+        while ( iterator.hasNext() )
+        {
+            MavenProject project = iterator.next();
+            projectNames.append( project.getGroupId() ).append( ":" ).append( project.getArtifactId()
);
+            if ( iterator.hasNext() )
+            {
+                projectNames.append( ", " );
+            }
+        }
+        return projectNames.toString();
+    }
+
     private boolean isMatchingProject( MavenProject project, String selector, File reactorDirectory
)
     {
         // [groupId]:artifactId


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Improve readability of project list returned when --resume-from option value is invalid
> ---------------------------------------------------------------------------------------
>
>                 Key: MNG-6411
>                 URL: https://issues.apache.org/jira/browse/MNG-6411
>             Project: Maven
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 3.5.3
>            Reporter: Ɓukasz Dywicki
>            Assignee: Michael Osipov
>            Priority: Minor
>             Fix For: 3.5.4
>
>
> When value passed for {{-rf}} option is invalid, a full list of details of all projects
in build is returned.
> This list contains too much information. For every project it includes groupId, artifactId,
version and pom location. While it is useful for debugging purposes many, if not most, developers
are interested in specific coordinate (groupId:artifactId) which should be passed to next
execution, and which is valid {{-rf}} optional value.
> *Note that below outputs contain new lines for ease of read*. This could be also added
to exception message to make it more readable.
> Assuming, that I've passed -rf :x Current output in case of failure:
> {noformat}
> ERROR] Could not find project to resume reactor build from: :x vs [
> 	MavenProject: com.example:foobar:1.0.0-SNAPSHOT @ ~/sources/foobar/pom.xml,
> 	MavenProject: com.example.foobar:parent:1.0.0-SNAPSHOT @ ~/sources/foobar/parent/pom.xml,
> 	MavenProject: com.example.foobar:api:1.0.0-SNAPSHOT @ ~/sources/foobar/api/pom.xml,
> 	MavenProject: com.example.foobar:model:1.0.0-SNAPSHOT @ ~/sources/foobar/model/pom.xml,
> 	MavenProject: com.example.foobar:csv:1.0.0-SNAPSHOT @ ~/sources/foobar/csv/pom.xml,
> 	MavenProject: com.example.foobar.csv:model:1.0.0-SNAPSHOT @ ~/sources/foobar/csv/model/pom.xml,
> 	MavenProject: com.example.foobar.csv:api:1.0.0-SNAPSHOT @ ~/sources/foobar/csv/api/pom.xml,
> 	MavenProject: com.example.foobar:json:1.0.0-SNAPSHOT @ ~/sources/foobar/json/pom.xml,
> 	MavenProject: com.example.foobar.json:model:1.0.0-SNAPSHOT @ ~/sources/foobar/json/model/pom.xml,
> 	MavenProject: com.example.foobar.json:api:1.0.0-SNAPSHOT @ ~/sources/foobar/json/api/pom.xml,
> 	MavenProject: com.example.foobar.json:core:1.0.0-SNAPSHOT @ ~/sources/foobar/json/core/pom.xml,
> 	MavenProject: com.example.foobar:fax:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/pom.xml,
> 	MavenProject: com.example.foobar.fax:api:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/api/pom.xml,
> 	MavenProject: com.example.foobar.fax:model:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/model/pom.xml,
> 	MavenProject: com.example.foobar.fax:web:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/web/pom.xml,
> 	MavenProject: com.example.foobar.fax.web:api:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/web/api/pom.xml,
> 	MavenProject: com.example.foobar.fax.web:core:1.0.0-SNAPSHOT @ ~/sources/foobar/fax/web/core/pom.xml]
-> [Help 1]
> {noformat}
> Additional information about pom locations is irrelevant from message point of view,
because valid input for -rf option is presented below:
> {noformat}
> ERROR] Could not find project to resume reactor build from: :x vs [
> 	com.example:foobar,
> 	com.example.foobar:parent,
> 	com.example.foobar:api,
> 	com.example.foobar:model,
> 	com.example.foobar:csv,
> 	com.example.foobar.csv:model,
> 	com.example.foobar.csv:api,
> 	com.example.foobar:json,
> 	com.example.foobar.json:model,
> 	com.example.foobar.json:api,
> 	com.example.foobar.json:core,
> 	com.example.foobar:fax,
> 	com.example.foobar.fax:api,
> 	com.example.foobar.fax:model,
> 	com.example.foobar.fax:web,
> 	com.example.foobar.fax.web:api,
> 	com.example.foobar.fax.web:core] -> [Help 1]
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message