o Added transfer listener for project dependency downloads

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@825299 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-10-14 21:43:21 +00:00
parent 6821063783
commit 60b6c026c9
4 changed files with 25 additions and 7 deletions

View File

@ -26,6 +26,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
import org.apache.maven.artifact.resolver.TransferListenerAdapter;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Profile;
@ -142,7 +143,7 @@ public class DefaultProjectBuilder
.setOffline( configuration.isOffline() )
.setForceUpdate( configuration.isForceUpdate() )
.setManagedVersionMap( project.getManagedVersionMap() );
// FIXME setTransferListener
artifactRequest.setTransferListener( TransferListenerAdapter.newAdapter( configuration.getTransferListener() ) );
artifactResult = repositorySystem.resolve( artifactRequest );
@ -205,7 +206,8 @@ public class DefaultProjectBuilder
.setRemoteRepositories( configuration.getRemoteRepositories() )
.setOffline( configuration.isOffline() )
.setForceUpdate( configuration.isForceUpdate() );
// FIXME setTransferListener
request.setTransferListener( TransferListenerAdapter.newAdapter( configuration.getTransferListener() ) );
ArtifactResolutionResult result = repositorySystem.resolve( request );
try

View File

@ -29,6 +29,7 @@ import org.apache.maven.artifact.repository.RepositoryCache;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelEventListener;
import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
@ -77,6 +78,8 @@ public class DefaultProjectBuildingRequest
private boolean resolveDependencies;
private ArtifactTransferListener transferListener;
public DefaultProjectBuildingRequest()
{
processPlugins = true;
@ -394,4 +397,14 @@ public class DefaultProjectBuildingRequest
this.buildStartTime = buildStartTime;
}
public ArtifactTransferListener getTransferListener()
{
return transferListener;
}
public void setTransferListener( ArtifactTransferListener transferListener )
{
this.transferListener = transferListener;
}
}

View File

@ -27,6 +27,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryCache;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
@ -174,8 +175,8 @@ public interface ProjectBuildingRequest
*/
void setBuildStartTime( Date buildStartTime );
// TODO ?
//TransferListener getTransferListener();
//void setTransferListener ( TransferListener transferListener );
ArtifactTransferListener getTransferListener();
void setTransferListener( ArtifactTransferListener transferListener );
}

View File

@ -30,6 +30,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
import org.apache.maven.artifact.resolver.TransferListenerAdapter;
import org.apache.maven.model.Repository;
import org.apache.maven.model.building.FileModelSource;
import org.apache.maven.model.building.ModelSource;
@ -136,7 +137,8 @@ class RepositoryModelResolver
request.setLocalRepository( projectBuildingRequest.getLocalRepository() );
request.setOffline( projectBuildingRequest.isOffline() );
request.setCache( projectBuildingRequest.getRepositoryCache() );
// FIXME setTransferListener
request.setTransferListener( TransferListenerAdapter.newAdapter( projectBuildingRequest.getTransferListener() ) );
ArtifactResolutionResult result = repositorySystem.resolve( request );
try