From 58cf490c696cebfb0cc3dce31fed68658b16626f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 6 Jan 2018 22:14:00 +0100 Subject: [PATCH] [MNG-6308] added packaging in Building message footer and summary --- .../org/apache/maven/cli/event/ExecutionEventLogger.java | 9 +++++++-- .../apache/maven/cli/event/ExecutionEventLoggerTest.java | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) 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 3da9ad3462..85760e6d05 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 @@ -114,7 +114,9 @@ public class ExecutionEventLogger final List projects = event.getSession().getProjects(); for ( MavenProject project : projects ) { - logger.info( project.getName() ); + int len = LINE_LENGTH - project.getName().length() - project.getPackaging().length() - 2; + logger.info( project.getName() + chars( ' ', ( len > 0 ) ? len : 1 ) + '[' + project.getPackaging() + + ']' ); } totalProjects = projects.size(); @@ -302,7 +304,10 @@ public class ExecutionEventLogger infoMain( building + ( ( pad > 0 ) ? chars( ' ', pad ) : "" ) + progress ); } - infoLine( '-' ); + // ----------[ packaging ]---------- + prefix = chars( '-', Math.max( 0, ( LINE_LENGTH - project.getPackaging().length() - 4 ) / 2 ) ); + suffix = chars( '-', Math.max( 0, LINE_LENGTH - project.getPackaging().length() - 4 - prefix.length() ) ); + infoMain( prefix + "[ " + project.getPackaging() + " ]" + suffix ); } } diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java index 4c0539db64..ca4c8a47cb 100644 --- a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java @@ -73,7 +73,7 @@ public class ExecutionEventLoggerTest inOrder.verify( logger ).info( "" ); inOrder.verify( logger ).info( "------------------< org.apache.maven:maven-embedder >-------------------" ); inOrder.verify( logger ).info( "Building Apache Maven Embedder 3.5.4-SNAPSHOT" ); - inOrder.verify( logger ).info( "------------------------------------------------------------------------" ); + inOrder.verify( logger ).info( "--------------------------------[ jar ]---------------------------------" ); } @Test @@ -101,6 +101,6 @@ public class ExecutionEventLoggerTest inOrder.verify( logger ).info( "" ); inOrder.verify( logger ).info( "--< org.apache.maven.plugins.overflow:maven-project-info-reports-plugin >--" ); inOrder.verify( logger ).info( "Building Apache Maven Project Info Reports Plugin 3.0.0-SNAPSHOT" ); - inOrder.verify( logger ).info( "------------------------------------------------------------------------" ); + inOrder.verify( logger ).info( "----------------------------[ maven-plugin ]----------------------------" ); } }