[MNG-4461] [regression] No transfer progress during artifact deployment

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@882668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-11-20 18:18:54 +00:00
parent 1d14aab24a
commit 7a5ccb383b
1 changed files with 21 additions and 1 deletions

View File

@ -23,9 +23,13 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataDeploymentException;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.legacy.TransferListenerAdapter;
import org.apache.maven.repository.legacy.WagonManager;
import org.apache.maven.repository.legacy.resolver.transform.ArtifactTransformationManager;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.events.TransferListener;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
@ -45,6 +49,9 @@ public class DefaultArtifactDeployer
@Requirement
private RepositoryMetadataManager repositoryMetadataManager;
@Requirement
private LegacySupport legacySupport;
/**
* @deprecated we want to use the artifact method only, and ensure artifact.file is set
* correctly.
@ -72,7 +79,7 @@ public class DefaultArtifactDeployer
FileUtils.copyFile( source, artifactFile );
}
wagonManager.putArtifact( source, artifact, deploymentRepository, null );
wagonManager.putArtifact( source, artifact, deploymentRepository, getTransferListener() );
// must be after the artifact is installed
for ( ArtifactMetadata metadata : artifact.getMetadataList() )
@ -93,4 +100,17 @@ public class DefaultArtifactDeployer
throw new ArtifactDeploymentException( "Error installing artifact's metadata: " + e.getMessage(), e );
}
}
private TransferListener getTransferListener()
{
MavenSession session = legacySupport.getSession();
if ( session == null )
{
return null;
}
return TransferListenerAdapter.newAdapter( session.getRequest().getTransferListener() );
}
}