hboutemy commented on code in PR #1231:
URL: https://github.com/apache/maven/pull/1231#discussion_r1320812506


##########
maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java:
##########
@@ -214,18 +227,37 @@ public void transferSucceeded(TransferEvent event) {
         FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH);
 
         StringBuilder message = new StringBuilder();
-        message.append(action).append(' ').append(direction).append(' 
').append(resource.getRepositoryId());
-        message.append(": ");
-        
message.append(resource.getRepositoryUrl()).append(resource.getResourceName());
-        message.append(" (").append(format.format(contentLength));
+        message.append(action).append(lowOn).append(' 
').append(direction).append(' ');
+        message.append(lowOff).append(resource.getRepositoryId());
+        message.append(lowOn).append(": ");
+        message.append(resource.getRepositoryUrl()).append(lowOff);
+        appendResource(message, resource.getResourceName());
+        message.append(lowOn).append(" 
(").append(format.format(contentLength));
 
         long duration = System.currentTimeMillis() - 
resource.getTransferStartTime();
         if (duration > 0L) {
             double bytesPerSecond = contentLength / (duration / 1000.0);
             message.append(" at ").append(format.format((long) 
bytesPerSecond)).append("/s");
         }
 
-        message.append(')');
+        message.append(')').append(lowOff);
         out.println(message.toString());
     }
+
+    private void appendResource(StringBuilder message, String resource) {
+        if (!MessageUtils.isColorEnabled()) {
+            message.append(resource);
+            return;
+        }
+        int filename = resource.lastIndexOf('/');
+        int version = resource.substring(0, filename).lastIndexOf('/');
+        int artifactId = resource.substring(0, version).lastIndexOf('/');

Review Comment:
   testing on https://github.com/eclipse-tycho/tycho/tree/master/demo/itp04-rcp
   
   ```
   ❯ \rm -rf ~/.m2/repository/p2/
   ❯ mvn package
   [INFO] Scanning for projects...
   [INFO] Resolving target definition 
file:/home/herve/tmp/tycho/demo/itp04-rcp/mars/mars.target for 
environments=[win32/win32/x86_64, linux/gtk/x86_64, macosx/cocoa/x86_64], 
include source mode=honor, execution environment=StandardEEResolutionHints 
[executionEnvironment=OSGi profile 'JavaSE-11' { source level: 11, target 
level: 11}], remote p2 repository 
options=org.eclipse.tycho.p2.remote.RemoteAgent@77db231c...
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   [INFO] Resolving dependencies of MavenProject: 
example.group:eclipse-repository:1.0.0-SNAPSHOT @ 
/home/herve/tmp/tycho/demo/itp04-rcp/eclipse-repository/pom.xml
   [INFO] Resolving dependencies of MavenProject: 
example.group:example-bundle:0.1.0-SNAPSHOT @ 
/home/herve/tmp/tycho/demo/itp04-rcp/example-bundle/pom.xml
   [INFO] Fetching 202206151000&countryCode=fr&timeZone=1&format=xml from 
https://www.eclipse.org/downloads/download.php?format=xml&file=/releases/2022-06/
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(12,94MB)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(179,24kB of 12,94MB at 175,24kB/s)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(1,67MB of 12,94MB at 782,9kB/s)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(6,32MB of 12,94MB at 2,1MB/s)
   ...
   ```
   
   transfer from p2 seems to be implemented outside Maven core, then not 
affected
   
   assumption of Maven 2 repository layout seems reasonable
   
   



##########
maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java:
##########
@@ -214,18 +227,37 @@ public void transferSucceeded(TransferEvent event) {
         FileSizeFormat format = new FileSizeFormat(Locale.ENGLISH);
 
         StringBuilder message = new StringBuilder();
-        message.append(action).append(' ').append(direction).append(' 
').append(resource.getRepositoryId());
-        message.append(": ");
-        
message.append(resource.getRepositoryUrl()).append(resource.getResourceName());
-        message.append(" (").append(format.format(contentLength));
+        message.append(action).append(lowOn).append(' 
').append(direction).append(' ');
+        message.append(lowOff).append(resource.getRepositoryId());
+        message.append(lowOn).append(": ");
+        message.append(resource.getRepositoryUrl()).append(lowOff);
+        appendResource(message, resource.getResourceName());
+        message.append(lowOn).append(" 
(").append(format.format(contentLength));
 
         long duration = System.currentTimeMillis() - 
resource.getTransferStartTime();
         if (duration > 0L) {
             double bytesPerSecond = contentLength / (duration / 1000.0);
             message.append(" at ").append(format.format((long) 
bytesPerSecond)).append("/s");
         }
 
-        message.append(')');
+        message.append(')').append(lowOff);
         out.println(message.toString());
     }
+
+    private void appendResource(StringBuilder message, String resource) {
+        if (!MessageUtils.isColorEnabled()) {
+            message.append(resource);
+            return;
+        }
+        int filename = resource.lastIndexOf('/');
+        int version = resource.substring(0, filename).lastIndexOf('/');
+        int artifactId = resource.substring(0, version).lastIndexOf('/');

Review Comment:
   testing on https://github.com/eclipse-tycho/tycho/tree/master/demo/itp04-rcp
   
   ```
   ❯ \rm -rf ~/.m2/repository/p2/
   ❯ mvn package
   [INFO] Scanning for projects...
   [INFO] Resolving target definition 
file:/home/herve/tmp/tycho/demo/itp04-rcp/mars/mars.target for 
environments=[win32/win32/x86_64, linux/gtk/x86_64, macosx/cocoa/x86_64], 
include source mode=honor, execution environment=StandardEEResolutionHints 
[executionEnvironment=OSGi profile 'JavaSE-11' { source level: 11, target 
level: 11}], remote p2 repository 
options=org.eclipse.tycho.p2.remote.RemoteAgent@77db231c...
   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
   [INFO] Resolving dependencies of MavenProject: 
example.group:eclipse-repository:1.0.0-SNAPSHOT @ 
/home/herve/tmp/tycho/demo/itp04-rcp/eclipse-repository/pom.xml
   [INFO] Resolving dependencies of MavenProject: 
example.group:example-bundle:0.1.0-SNAPSHOT @ 
/home/herve/tmp/tycho/demo/itp04-rcp/example-bundle/pom.xml
   [INFO] Fetching 202206151000&countryCode=fr&timeZone=1&format=xml from 
https://www.eclipse.org/downloads/download.php?format=xml&file=/releases/2022-06/
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(12,94MB)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(179,24kB of 12,94MB at 175,24kB/s)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(1,67MB of 12,94MB at 782,9kB/s)
   [INFO] Fetching com.ibm.icu_67.1.0.v20200706-1749.jar from 
https://mirror.aarnet.edu.au/pub/eclipse/releases/2022-06/202206151000/plugins/ 
(6,32MB of 12,94MB at 2,1MB/s)
   ...
   ```
   
   transfer from p2 seems to be implemented outside Maven core, then not 
affected
   
   assumption of Maven 2 repository layout seems reasonable
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to