[1/4] maven git commit: [MNG-6308] display groupId:artifactId in Building message header [Forced Update!]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/4] maven git commit: [MNG-6308] display groupId:artifactId in Building message header [Forced Update!]

khmarbaise
Repository: maven
Updated Branches:
  refs/heads/MNG-6312 e8bb08369 -> 2b336ff15 (forced update)


[MNG-6308] display groupId:artifactId in Building message header

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/c2e3b3e3
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/c2e3b3e3
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/c2e3b3e3

Branch: refs/heads/MNG-6312
Commit: c2e3b3e301a96e36670206db0c215f3026937d33
Parents: 98d2e19
Author: Hervé Boutemy <[hidden email]>
Authored: Sat Jan 6 22:12:08 2018 +0100
Committer: Hervé Boutemy <[hidden email]>
Committed: Sat Jan 6 22:40:29 2018 +0100

----------------------------------------------------------------------
 .../maven/cli/event/ExecutionEventLogger.java   | 21 ++++++++++++--
 .../cli/event/ExecutionEventLoggerTest.java     | 30 +++++++++++++++++++-
 2 files changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/c2e3b3e3/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 513d56a..3da9ad3 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
@@ -261,9 +261,26 @@ public class ExecutionEventLogger
     {
         if ( logger.isInfoEnabled() )
         {
+            MavenProject project = event.getProject();
+
             logger.info( "" );
-            infoLine( '-' );
 
+            // -------< groupId:artifactId >-------
+            String projectKey = project.getGroupId() + ':' + project.getArtifactId();
+            
+            final String preHeader  = "--< ";
+            final String postHeader = " >--";
+
+            final int headerLen = preHeader.length() + projectKey.length() + postHeader.length();
+
+            String prefix = chars( '-', Math.max( 0, ( LINE_LENGTH - headerLen ) / 2 ) ) + preHeader;
+
+            String suffix = postHeader
+                + chars( '-', Math.max( 0, LINE_LENGTH - headerLen - prefix.length() + preHeader.length() ) );
+
+            logger.info( buffer().strong( prefix ).project( projectKey ).strong( suffix ).toString() );
+
+            // Building Project Name Version    [i/n]
             String building = "Building " + event.getProject().getName() + " " + event.getProject().getVersion();
 
             if ( totalProjects <= 1 )
@@ -283,7 +300,7 @@ public class ExecutionEventLogger
                 int pad = LINE_LENGTH - building.length() - progress.length();
 
                 infoMain( building + ( ( pad > 0 ) ? chars( ' ', pad ) : "" ) + progress );
-            } // else what's the point
+            }
 
             infoLine( '-' );
         }

http://git-wip-us.apache.org/repos/asf/maven/blob/c2e3b3e3/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
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 515f9fe..4c0539d 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
@@ -71,8 +71,36 @@ public class ExecutionEventLoggerTest
         // verify
         InOrder inOrder = inOrder( logger );
         inOrder.verify( logger ).info( "" );
-        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( "------------------------------------------------------------------------" );
     }
+
+    @Test
+    public void testProjectStartedOverflow()
+    {
+        // prepare
+        Logger logger = mock( Logger.class );
+        when( logger.isInfoEnabled() ).thenReturn( true );
+        executionEventLogger = new ExecutionEventLogger( logger );
+
+        ExecutionEvent event = mock( ExecutionEvent.class );
+        MavenProject project = mock( MavenProject.class );
+        when( project.getGroupId() ).thenReturn( "org.apache.maven.plugins.overflow" );
+        when( project.getArtifactId() ).thenReturn( "maven-project-info-reports-plugin" );
+        when( project.getPackaging() ).thenReturn( "maven-plugin" );
+        when( project.getName() ).thenReturn( "Apache Maven Project Info Reports Plugin" );
+        when( project.getVersion() ).thenReturn( "3.0.0-SNAPSHOT" );
+        when( event.getProject() ).thenReturn( project );
+
+        // execute
+        executionEventLogger.projectStarted( event );
+
+        // verify
+        InOrder inOrder = inOrder( logger );
+        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( "------------------------------------------------------------------------" );
+    }
 }

Reply | Threaded
Open this post in threaded view
|

[2/4] maven git commit: [MNG-6308] added unit test for "Building" message

khmarbaise
[MNG-6308] added unit test for "Building" message

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/98d2e197
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/98d2e197
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/98d2e197

Branch: refs/heads/MNG-6312
Commit: 98d2e197d111d4863d1e420a9f9c1548690bc7e1
Parents: 68a9d79
Author: Hervé Boutemy <[hidden email]>
Authored: Sat Jan 6 22:07:17 2018 +0100
Committer: Hervé Boutemy <[hidden email]>
Committed: Sat Jan 6 22:40:29 2018 +0100

----------------------------------------------------------------------
 maven-embedder/pom.xml                          |  4 +
 .../cli/event/ExecutionEventLoggerTest.java     | 78 ++++++++++++++++++++
 2 files changed, 82 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/98d2e197/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index d6576f9..cfc126f 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -139,6 +139,10 @@ under the License.
       <artifactId>commons-lang3</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.fusesource.jansi</groupId>
       <artifactId>jansi</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/maven/blob/98d2e197/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..515f9fe
--- /dev/null
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
@@ -0,0 +1,78 @@
+package org.apache.maven.cli.event;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.utils.logging.MessageUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.InOrder;
+import org.slf4j.Logger;
+
+public class ExecutionEventLoggerTest
+{
+    private ExecutionEventLogger executionEventLogger;
+
+    @BeforeClass
+    public static void setUp()
+    {
+        MessageUtils.setColorEnabled( false );
+    }
+
+    @AfterClass
+    public static void tearDown()
+    {
+        MessageUtils.setColorEnabled( true );
+    }
+
+    @Test
+    public void testProjectStarted()
+    {
+        // prepare
+        Logger logger = mock( Logger.class );
+        when( logger.isInfoEnabled() ).thenReturn( true );
+        executionEventLogger = new ExecutionEventLogger( logger );
+
+        ExecutionEvent event = mock( ExecutionEvent.class );
+        MavenProject project = mock( MavenProject.class );
+        when( project.getGroupId() ).thenReturn( "org.apache.maven" );
+        when( project.getArtifactId() ).thenReturn( "maven-embedder" );
+        when( project.getPackaging() ).thenReturn( "jar" );
+        when( project.getName() ).thenReturn( "Apache Maven Embedder" );
+        when( project.getVersion() ).thenReturn( "3.5.4-SNAPSHOT" );
+        when( event.getProject() ).thenReturn( project );
+
+        // execute
+        executionEventLogger.projectStarted( event );
+
+        // verify
+        InOrder inOrder = inOrder( logger );
+        inOrder.verify( logger ).info( "" );
+        inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+        inOrder.verify( logger ).info( "Building Apache Maven Embedder 3.5.4-SNAPSHOT" );
+        inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+    }
+}

Reply | Threaded
Open this post in threaded view
|

[3/4] maven git commit: [MNG-6308] added packaging in Building message footer and summary

khmarbaise
In reply to this post by khmarbaise
[MNG-6308] added packaging in Building message footer and summary

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/58cf490c
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/58cf490c
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/58cf490c

Branch: refs/heads/MNG-6312
Commit: 58cf490c696cebfb0cc3dce31fed68658b16626f
Parents: c2e3b3e
Author: Hervé Boutemy <[hidden email]>
Authored: Sat Jan 6 22:14:00 2018 +0100
Committer: Hervé Boutemy <[hidden email]>
Committed: Sat Jan 6 22:40:30 2018 +0100

----------------------------------------------------------------------
 .../org/apache/maven/cli/event/ExecutionEventLogger.java    | 9 +++++++--
 .../apache/maven/cli/event/ExecutionEventLoggerTest.java    | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/58cf490c/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 3da9ad3..85760e6 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<MavenProject> 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 );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/58cf490c/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
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 4c0539d..ca4c8a4 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 ]----------------------------" );
     }
 }

Reply | Threaded
Open this post in threaded view
|

[4/4] maven git commit: [MNG-6312] Update Maven Wagon dependency o Upgrade wagon version to 3.0.0 based on CVE-2015-6748 in shaded jsoup.

khmarbaise
In reply to this post by khmarbaise
[MNG-6312] Update Maven Wagon dependency
 o Upgrade wagon version to 3.0.0 based on CVE-2015-6748
   in shaded jsoup.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2b336ff1
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2b336ff1
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2b336ff1

Branch: refs/heads/MNG-6312
Commit: 2b336ff150b12aeae9bd0d2a61f1e8d02504492f
Parents: 58cf490
Author: Karl Heinz Marbaise <[hidden email]>
Authored: Sat Jan 6 22:59:32 2018 +0100
Committer: Karl Heinz Marbaise <[hidden email]>
Committed: Sat Jan 13 12:46:18 2018 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/2b336ff1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bb87aca..d03a25a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,7 @@ under the License.
     <guavaVersion>20.0</guavaVersion>
     <guiceVersion>4.0</guiceVersion>
     <sisuInjectVersion>0.3.3</sisuInjectVersion>
-    <wagonVersion>2.12</wagonVersion>
+    <wagonVersion>3.0.0</wagonVersion>
     <securityDispatcherVersion>1.4</securityDispatcherVersion>
     <cipherVersion>1.7</cipherVersion>
     <modelloVersion>1.9.1</modelloVersion>