mirror of https://github.com/apache/maven.git
[MNG-5457] Show repository id when downloading or uploading from/to a remote repository
This commit is contained in:
parent
e520324c8d
commit
b100257517
|
@ -217,9 +217,15 @@ public abstract class AbstractMavenTransferListener
|
||||||
public void transferInitiated( TransferEvent event )
|
public void transferInitiated( TransferEvent event )
|
||||||
{
|
{
|
||||||
String action = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
|
String action = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
|
||||||
|
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
|
||||||
|
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
out.println( action + ": " + resource.getRepositoryUrl() + resource.getResourceName() );
|
StringBuilder message = new StringBuilder();
|
||||||
|
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
|
||||||
|
message.append( ": " );
|
||||||
|
message.append( resource.getRepositoryUrl() ).append( resource.getResourceName() );
|
||||||
|
|
||||||
|
out.println( message.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -228,30 +234,35 @@ public abstract class AbstractMavenTransferListener
|
||||||
{
|
{
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
// TODO This needs to be colorized
|
// TODO This needs to be colorized
|
||||||
out.println( "[WARNING] " + event.getException().getMessage() + " for " + resource.getRepositoryUrl()
|
out.println( "[WARNING] " + event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
|
||||||
+ resource.getResourceName() );
|
+ resource.getRepositoryUrl() + resource.getResourceName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transferSucceeded( TransferEvent event )
|
public void transferSucceeded( TransferEvent event )
|
||||||
{
|
{
|
||||||
|
String action = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
|
||||||
|
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
|
||||||
|
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
long contentLength = event.getTransferredBytes();
|
long contentLength = event.getTransferredBytes();
|
||||||
|
|
||||||
FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
|
FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
|
||||||
String result = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
|
|
||||||
String len = format.format( contentLength );
|
|
||||||
|
|
||||||
String throughput = "";
|
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 ) );
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
|
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
|
||||||
if ( duration > 0L )
|
if ( duration > 0L )
|
||||||
{
|
{
|
||||||
double bytesPerSecond = contentLength / ( duration / 1000.0 );
|
double bytesPerSecond = contentLength / ( duration / 1000.0 );
|
||||||
throughput = " at " + format.format( (long) bytesPerSecond ) + "/s";
|
message.append( " at " ).append( format.format( (long) bytesPerSecond ) ).append( "/s" );
|
||||||
}
|
}
|
||||||
|
|
||||||
out.println( result + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
|
message.append( ')' );
|
||||||
+ throughput + ")" );
|
out.println( message.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,15 @@ public class Slf4jMavenTransferListener
|
||||||
public void transferInitiated( TransferEvent event )
|
public void transferInitiated( TransferEvent event )
|
||||||
{
|
{
|
||||||
String action = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
|
String action = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
|
||||||
|
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
|
||||||
|
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
out.info( action + ": " + resource.getRepositoryUrl() + resource.getResourceName() );
|
StringBuilder message = new StringBuilder();
|
||||||
|
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
|
||||||
|
message.append( ": " );
|
||||||
|
message.append( resource.getRepositoryUrl() ).append( resource.getResourceName() );
|
||||||
|
|
||||||
|
out.info( message.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,30 +66,35 @@ public class Slf4jMavenTransferListener
|
||||||
throws TransferCancelledException
|
throws TransferCancelledException
|
||||||
{
|
{
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
out.warn( event.getException().getMessage() + " for " + resource.getRepositoryUrl()
|
out.warn( event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
|
||||||
+ resource.getResourceName() );
|
+ resource.getRepositoryUrl() + resource.getResourceName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transferSucceeded( TransferEvent event )
|
public void transferSucceeded( TransferEvent event )
|
||||||
{
|
{
|
||||||
|
String action = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
|
||||||
|
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
|
||||||
|
|
||||||
TransferResource resource = event.getResource();
|
TransferResource resource = event.getResource();
|
||||||
long contentLength = event.getTransferredBytes();
|
long contentLength = event.getTransferredBytes();
|
||||||
|
|
||||||
FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
|
FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
|
||||||
String result = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
|
|
||||||
String len = format.format( contentLength );
|
|
||||||
|
|
||||||
String throughput = "";
|
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 ) );
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
|
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
|
||||||
if ( duration > 0L )
|
if ( duration > 0L )
|
||||||
{
|
{
|
||||||
double bytesPerSecond = contentLength / ( duration / 1000.0 );
|
double bytesPerSecond = contentLength / ( duration / 1000.0 );
|
||||||
throughput = " at " + format.format( (long) bytesPerSecond ) + "/s";
|
message.append( " at " ).append( format.format( (long) bytesPerSecond ) ).append( "/s" );
|
||||||
}
|
}
|
||||||
|
|
||||||
out.info( result + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
|
message.append( ')' );
|
||||||
+ throughput + ")" );
|
out.info( message.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue