maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject maven git commit: [MNG-6352] - Printout version information at the end of the build
Date Thu, 08 Feb 2018 19:48:23 GMT
Repository: maven
Updated Branches:
  refs/heads/MNG-6352-print-version [created] 6fe22404a


[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/6fe22404
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/6fe22404
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/6fe22404

Branch: refs/heads/MNG-6352-print-version
Commit: 6fe22404ac3a076603eb09fab345a3d6f6a23b0c
Parents: 99e6622
Author: Karl Heinz Marbaise <khmarbaise@apache.org>
Authored: Thu Feb 8 20:47:25 2018 +0100
Committer: Karl Heinz Marbaise <khmarbaise@apache.org>
Committed: Thu Feb 8 20:47:25 2018 +0100

----------------------------------------------------------------------
 .../maven/cli/event/ExecutionEventLogger.java   | 45 ++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/6fe22404/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..a6d4df4 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
@@ -135,10 +135,55 @@ public class ExecutionEventLogger
 
             logResult( event.getSession() );
 
+            logVersion( event.getSession() );
+
             logStats( event.getSession() );
 
             infoLine( '-' );
+
+        }
+    }
+
+    private void logVersion( MavenSession session )
+    {
+        if ( logger.isInfoEnabled() )
+        {
+
+            infoLine( '-' );
+
+            logger.info( "" );
+
+            infoMain( "Version Summary:" );
+
+            logger.info( "" );
+
+            if ( session.getProjects().size() > 1 )
+            {
+                final MavenProject topLevelProject = session.getTopLevelProject(); 
+                final String topLevelVersion = topLevelProject.getVersion();
+                final List<MavenProject> projects = session.getProjects();
+                formatSingeVersionLine( topLevelProject );
+                for ( MavenProject project : projects )
+                {
+                    if ( !topLevelProject.equals( project ) && !topLevelVersion.equals(
project.getVersion() ) )
+                    {
+                        formatSingeVersionLine( project );
+                    }
+                }
+            }
+            else
+            {
+                formatSingeVersionLine( session.getTopLevelProject() );
+            }
+
         }
+
+    }
+
+    private void formatSingeVersionLine( MavenProject project )
+    {
+        int len = LINE_LENGTH - project.getName().length() - project.getVersion().length()
- 2;
+        logger.info( project.getName() + chars( ' ', ( len > 0 ) ? len : 1 ) + '[' + project.getVersion()
+ ']' );
     }
 
     private void logReactorSummary( MavenSession session )


Mime
View raw message