[MNG-6302] display progress at end of "Building" line Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/f5f76c70 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/f5f76c70 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/f5f76c70
Branch: refs/heads/MNG-6255 Commit: f5f76c70e1828a7e6c6267fc4bc53abc35c19ce7 Parents: 4d49d3b Author: Hervé Boutemy <hbout...@apache.org> Authored: Wed Nov 15 03:54:15 2017 +0100 Committer: Hervé Boutemy <hbout...@apache.org> Committed: Wed Nov 15 03:54:15 2017 +0100 ---------------------------------------------------------------------- .../maven/cli/event/ExecutionEventLogger.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/f5f76c70/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java ---------------------------------------------------------------------- diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java index 6cab49f..513d56a 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java @@ -264,19 +264,28 @@ public class ExecutionEventLogger logger.info( "" ); infoLine( '-' ); - infoMain( "Building " + event.getProject().getName() + " " + event.getProject().getVersion() ); + String building = "Building " + event.getProject().getName() + " " + event.getProject().getVersion(); - infoLine( '-' ); - - if ( totalProjects > 1 ) + if ( totalProjects <= 1 ) + { + infoMain( building ); + } + else { + // display progress [i/n] int number; synchronized ( this ) { number = ++currentVisitedProjectCount; } - infoMain( "Module " + number + "/" + totalProjects ); + String progress = " [" + number + '/' + totalProjects + ']'; + + int pad = LINE_LENGTH - building.length() - progress.length(); + + infoMain( building + ( ( pad > 0 ) ? chars( ' ', pad ) : "" ) + progress ); } // else what's the point + + infoLine( '-' ); } }