Repository: maven Updated Branches: refs/heads/MNG-6352-print-version d9c49f13a -> 2de92a1dc (forced update)
[MNG-6352] - Printout version information at the end of the build Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2de92a1d Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2de92a1d Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2de92a1d Branch: refs/heads/MNG-6352-print-version Commit: 2de92a1dc67ef411cc894b387af19891252bebd3 Parents: cd34b08 Author: Karl Heinz Marbaise <khmarba...@apache.org> Authored: Thu Feb 8 20:47:25 2018 +0100 Committer: Karl Heinz Marbaise <khmarba...@apache.org> Committed: Fri Feb 16 19:59:56 2018 +0100 ---------------------------------------------------------------------- .../maven/cli/event/ExecutionEventLogger.java | 44 ++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/2de92a1d/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 d4171f7..788fd89 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 @@ -52,10 +52,13 @@ public class ExecutionEventLogger private final Logger logger; private static final int LINE_LENGTH = 72; + private static final int MAX_PADDED_BUILD_TIME_DURATION_LENGTH = 9; + private static final int MAX_PROJECT_NAME_LENGTH = 52; private int totalProjects; + private volatile int currentVisitedProjectCount; public ExecutionEventLogger() @@ -138,6 +141,7 @@ public class ExecutionEventLogger logStats( event.getSession() ); infoLine( '-' ); + } } @@ -151,6 +155,7 @@ public class ExecutionEventLogger MavenExecutionResult result = session.getResult(); + MavenProject topProject = session.getTopLevelProject(); for ( MavenProject project : session.getProjects() ) { StringBuilder buffer = new StringBuilder( 128 ); @@ -158,6 +163,17 @@ public class ExecutionEventLogger buffer.append( project.getName() ); buffer.append( ' ' ); + if ( topProject.equals( project ) ) + { + buffer.append( project.getVersion() ); + buffer.append( ' ' ); + } + else if ( !topProject.getVersion().equals( project.getVersion() ) ) + { + buffer.append( project.getVersion() ); + buffer.append( ' ' ); + } + if ( buffer.length() <= MAX_PROJECT_NAME_LENGTH ) { while ( buffer.length() < MAX_PROJECT_NAME_LENGTH ) @@ -261,8 +277,8 @@ public class ExecutionEventLogger // -------< groupId:artifactId >------- String projectKey = project.getGroupId() + ':' + project.getArtifactId(); - - final String preHeader = "--< "; + + final String preHeader = "--< "; final String postHeader = " >--"; final int headerLen = preHeader.length() + projectKey.length() + postHeader.length(); @@ -274,7 +290,7 @@ public class ExecutionEventLogger logger.info( buffer().strong( prefix ).project( projectKey ).strong( suffix ).toString() ); - // Building Project Name Version [i/n] + // Building Project Name Version [i/n] String building = "Building " + event.getProject().getName() + " " + event.getProject().getVersion(); if ( totalProjects <= 1 ) @@ -314,7 +330,9 @@ public class ExecutionEventLogger } /** - * <pre>--- mojo-artifactId:version:goal (mojo-executionId) @ project-artifactId ---</pre> + * <pre> + * --- mojo-artifactId:version:goal (mojo-executionId) @ project-artifactId --- + * </pre> */ @Override public void mojoStarted( ExecutionEvent event ) @@ -334,8 +352,13 @@ public class ExecutionEventLogger // CHECKSTYLE_OFF: LineLength /** - * <pre>>>> mojo-artifactId:version:goal (mojo-executionId) > :forked-goal @ project-artifactId >>></pre> - * <pre>>>> mojo-artifactId:version:goal (mojo-executionId) > [lifecycle]phase @ project-artifactId >>></pre> + * <pre> + * >>> mojo-artifactId:version:goal (mojo-executionId) > :forked-goal @ project-artifactId >>> + * </pre> + * + * <pre> + * >>> mojo-artifactId:version:goal (mojo-executionId) > [lifecycle]phase @ project-artifactId >>> + * </pre> */ // CHECKSTYLE_ON: LineLength @Override @@ -358,8 +381,13 @@ public class ExecutionEventLogger // CHECKSTYLE_OFF: LineLength /** - * <pre><<< mojo-artifactId:version:goal (mojo-executionId) < :forked-goal @ project-artifactId <<<</pre> - * <pre><<< mojo-artifactId:version:goal (mojo-executionId) < [lifecycle]phase @ project-artifactId <<<</pre> + * <pre> + * <<< mojo-artifactId:version:goal (mojo-executionId) < :forked-goal @ project-artifactId <<< + * </pre> + * + * <pre> + * <<< mojo-artifactId:version:goal (mojo-executionId) < [lifecycle]phase @ project-artifactId <<< + * </pre> */ // CHECKSTYLE_ON: LineLength @Override