mirror of https://github.com/apache/maven.git
o Added transfer listener for further downloads
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@825494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
865134cd8e
commit
759928f4d0
|
@ -22,6 +22,8 @@ package org.apache.maven.artifact.repository;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects basic settings to access the repository system.
|
||||
*
|
||||
|
@ -41,6 +43,8 @@ public class DefaultRepositoryRequest
|
|||
|
||||
private RepositoryCache cache;
|
||||
|
||||
private ArtifactTransferListener transferListener;
|
||||
|
||||
/**
|
||||
* Creates an empty repository request.
|
||||
*/
|
||||
|
@ -61,6 +65,7 @@ public class DefaultRepositoryRequest
|
|||
setOffline( repositoryRequest.isOffline() );
|
||||
setCache( repositoryRequest.getCache() );
|
||||
setForceUpdate( repositoryRequest.isForceUpdate() );
|
||||
setTransferListener( repositoryRequest.getTransferListener() );
|
||||
}
|
||||
|
||||
public boolean isOffline()
|
||||
|
@ -128,4 +133,16 @@ public class DefaultRepositoryRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public ArtifactTransferListener getTransferListener()
|
||||
{
|
||||
return transferListener;
|
||||
}
|
||||
|
||||
public DefaultRepositoryRequest setTransferListener( ArtifactTransferListener transferListener )
|
||||
{
|
||||
this.transferListener = transferListener;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.apache.maven.artifact.repository;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects basic settings to access the repository system.
|
||||
*
|
||||
|
@ -107,4 +109,19 @@ public interface RepositoryRequest
|
|||
*/
|
||||
RepositoryRequest setCache( RepositoryCache cache );
|
||||
|
||||
/**
|
||||
* Gets the listener to notify of transfer events.
|
||||
*
|
||||
* @return The transfer listener or {@code null} if none.
|
||||
*/
|
||||
ArtifactTransferListener getTransferListener();
|
||||
|
||||
/**
|
||||
* Sets the listener to notify of transfer events.
|
||||
*
|
||||
* @param transferListener The transfer listener to notify, may be {@code null}.
|
||||
* @return This request, never {@code null}.
|
||||
*/
|
||||
RepositoryRequest setTransferListener( ArtifactTransferListener transferListener );
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* A resolution request allows you to either use an existing MavenProject, or a coordinate (gid:aid:version)
|
||||
|
@ -64,7 +64,7 @@ public class ArtifactResolutionRequest
|
|||
// This is like a filter but overrides all transitive versions
|
||||
private Map managedVersionMap;
|
||||
|
||||
private TransferListener transferListener;
|
||||
private ArtifactTransferListener transferListener;
|
||||
|
||||
private boolean resolveRoot = true;
|
||||
|
||||
|
@ -86,6 +86,7 @@ public class ArtifactResolutionRequest
|
|||
setCache( request.getCache() );
|
||||
setOffline( request.isOffline() );
|
||||
setForceUpdate( request.isForceUpdate() );
|
||||
setTransferListener( request.getTransferListener() );
|
||||
}
|
||||
|
||||
public Artifact getArtifact()
|
||||
|
@ -228,12 +229,12 @@ public class ArtifactResolutionRequest
|
|||
return resolveTransitively;
|
||||
}
|
||||
|
||||
public TransferListener getTransferListener()
|
||||
public ArtifactTransferListener getTransferListener()
|
||||
{
|
||||
return transferListener;
|
||||
}
|
||||
|
||||
public ArtifactResolutionRequest setTransferListener( TransferListener transferListener )
|
||||
public ArtifactResolutionRequest setTransferListener( ArtifactTransferListener transferListener )
|
||||
{
|
||||
this.transferListener = transferListener;
|
||||
return this;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.maven.artifact.repository.metadata.Snapshot;
|
|||
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||
import org.apache.maven.repository.legacy.WagonManager;
|
||||
import org.apache.maven.repository.legacy.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest;
|
||||
|
@ -371,6 +372,7 @@ public class DefaultArtifactResolver
|
|||
List<ResolutionListener> listeners = request.getListeners();
|
||||
ArtifactFilter collectionFilter = request.getCollectionFilter();
|
||||
ArtifactFilter resolutionFilter = request.getResolutionFilter();
|
||||
TransferListener transferListener = TransferListenerAdapter.newAdapter( request.getTransferListener() );
|
||||
|
||||
//TODO: hack because metadata isn't generated in m2e correctly and i want to run the maven i have in the workspace
|
||||
if ( source == null )
|
||||
|
@ -408,7 +410,7 @@ public class DefaultArtifactResolver
|
|||
{
|
||||
try
|
||||
{
|
||||
resolve( rootArtifact, request, request.getTransferListener(), false );
|
||||
resolve( rootArtifact, request, transferListener, false );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
|
@ -512,7 +514,7 @@ public class DefaultArtifactResolver
|
|||
{
|
||||
childRequest.setRemoteRepositories( node.getRemoteRepositories() );
|
||||
|
||||
resolve( artifact, childRequest, request.getTransferListener(), false );
|
||||
resolve( artifact, childRequest, transferListener, false );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactNotFoundException anfe )
|
||||
|
|
|
@ -306,12 +306,6 @@ public class DefaultWagonManager
|
|||
|
||||
if ( downloaded )
|
||||
{
|
||||
if ( logger.isInfoEnabled() )
|
||||
{
|
||||
String url = String.valueOf( repository.getUrl() );
|
||||
logger.info( "Downloaded " + url + ( url.endsWith( "/" ) ? "" : "/" ) + remotePath );
|
||||
}
|
||||
|
||||
// keep the checksum files from showing up on the download monitor...
|
||||
if ( downloadMonitor != null )
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
|
||||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Forms a request to retrieve artifact metadata.
|
||||
|
@ -136,4 +137,16 @@ public class DefaultMetadataResolutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public ArtifactTransferListener getTransferListener()
|
||||
{
|
||||
return repositoryRequest.getTransferListener();
|
||||
}
|
||||
|
||||
public DefaultMetadataResolutionRequest setTransferListener( ArtifactTransferListener transferListener )
|
||||
{
|
||||
repositoryRequest.setTransferListener( transferListener );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
|
@ -136,7 +135,7 @@ public class DefaultProjectDependenciesResolver
|
|||
.setOffline( session.isOffline() )
|
||||
.setForceUpdate( session.getRequest().isUpdateSnapshots() )
|
||||
.setCache( session.getRepositoryCache() );
|
||||
request.setTransferListener( TransferListenerAdapter.newAdapter( session.getRequest().getTransferListener() ) );
|
||||
request.setTransferListener( session.getRequest().getTransferListener() );
|
||||
|
||||
Set<String> projectIds = null;
|
||||
|
||||
|
|
|
@ -966,6 +966,7 @@ public class DefaultLifecycleExecutor
|
|||
request.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
||||
}
|
||||
request.setOffline( session.isOffline() );
|
||||
request.setTransferListener( session.getRequest().getTransferListener() );
|
||||
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -344,6 +344,7 @@ public class DefaultMavenPluginManager
|
|||
request.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
||||
request.setCache( session.getRepositoryCache() );
|
||||
request.setOffline( session.isOffline() );
|
||||
request.setTransferListener( session.getRequest().getTransferListener() );
|
||||
|
||||
List<Artifact> pluginArtifacts =
|
||||
resolvePluginArtifacts( plugin, pluginArtifact, request, project.getExtensionArtifactFilter() );
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.maven.artifact.repository.RepositoryRequest;
|
|||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects settings required to resolve a plugin prefix.
|
||||
|
@ -82,6 +83,7 @@ public class DefaultPluginPrefixRequest
|
|||
setCache( session.getRepositoryCache() );
|
||||
setLocalRepository( session.getLocalRepository() );
|
||||
setOffline( session.isOffline() );
|
||||
setTransferListener( session.getRequest().getTransferListener() );
|
||||
|
||||
MavenProject project = session.getCurrentProject();
|
||||
if ( project != null )
|
||||
|
@ -194,4 +196,16 @@ public class DefaultPluginPrefixRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public ArtifactTransferListener getTransferListener()
|
||||
{
|
||||
return repositoryRequest.getTransferListener();
|
||||
}
|
||||
|
||||
public DefaultPluginPrefixRequest setTransferListener( ArtifactTransferListener transferListener )
|
||||
{
|
||||
repositoryRequest.setTransferListener( transferListener );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects settings required to resolve a plugin prefix.
|
||||
|
@ -143,4 +144,19 @@ public interface PluginPrefixRequest
|
|||
*/
|
||||
PluginPrefixRequest setCache( RepositoryCache cache );
|
||||
|
||||
/**
|
||||
* Gets the listener to notify of transfer events.
|
||||
*
|
||||
* @return The transfer listener or {@code null} if none.
|
||||
*/
|
||||
ArtifactTransferListener getTransferListener();
|
||||
|
||||
/**
|
||||
* Sets the listener to notify of transfer events.
|
||||
*
|
||||
* @param transferListener The transfer listener to notify, may be {@code null}.
|
||||
* @return This request, never {@code null}.
|
||||
*/
|
||||
PluginPrefixRequest setTransferListener( ArtifactTransferListener transferListener );
|
||||
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public class DefaultPluginPrefixResolver
|
|||
|
||||
try
|
||||
{
|
||||
repositorySystem.retrieve( repository, destination, remotePath, null );
|
||||
repositorySystem.retrieve( repository, destination, remotePath, request.getTransferListener() );
|
||||
}
|
||||
catch ( ArtifactTransferFailedException e )
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.maven.artifact.repository.RepositoryRequest;
|
|||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects settings required to resolve the version for a plugin.
|
||||
|
@ -91,6 +92,7 @@ public class DefaultPluginVersionRequest
|
|||
setCache( session.getRepositoryCache() );
|
||||
setLocalRepository( session.getLocalRepository() );
|
||||
setOffline( session.isOffline() );
|
||||
setTransferListener( session.getRequest().getTransferListener() );
|
||||
|
||||
MavenProject project = session.getCurrentProject();
|
||||
if ( project != null )
|
||||
|
@ -183,4 +185,16 @@ public class DefaultPluginVersionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public ArtifactTransferListener getTransferListener()
|
||||
{
|
||||
return repositoryRequest.getTransferListener();
|
||||
}
|
||||
|
||||
public DefaultPluginVersionRequest setTransferListener( ArtifactTransferListener transferListener )
|
||||
{
|
||||
repositoryRequest.setTransferListener( transferListener );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryCache;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.repository.ArtifactTransferListener;
|
||||
|
||||
/**
|
||||
* Collects settings required to resolve the version for a plugin.
|
||||
|
@ -125,4 +126,19 @@ public interface PluginVersionRequest
|
|||
*/
|
||||
PluginVersionRequest setCache( RepositoryCache cache );
|
||||
|
||||
/**
|
||||
* Gets the listener to notify of transfer events.
|
||||
*
|
||||
* @return The transfer listener or {@code null} if none.
|
||||
*/
|
||||
ArtifactTransferListener getTransferListener();
|
||||
|
||||
/**
|
||||
* Sets the listener to notify of transfer events.
|
||||
*
|
||||
* @param transferListener The transfer listener to notify, may be {@code null}.
|
||||
* @return This request, never {@code null}.
|
||||
*/
|
||||
PluginVersionRequest setTransferListener( ArtifactTransferListener transferListener );
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ public class DefaultPluginVersionResolver
|
|||
|
||||
try
|
||||
{
|
||||
repositorySystem.retrieve( repository, artifactMetadataFile, remotePath, null );
|
||||
repositorySystem.retrieve( repository, artifactMetadataFile, remotePath,
|
||||
request.getTransferListener() );
|
||||
}
|
||||
catch ( ArtifactTransferFailedException e )
|
||||
{
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.apache.maven.model.building.UrlModelSource;
|
|||
import org.apache.maven.model.resolution.ModelResolver;
|
||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.util.Os;
|
||||
|
@ -143,7 +142,7 @@ public class DefaultProjectBuilder
|
|||
.setOffline( configuration.isOffline() )
|
||||
.setForceUpdate( configuration.isForceUpdate() )
|
||||
.setManagedVersionMap( project.getManagedVersionMap() );
|
||||
artifactRequest.setTransferListener( TransferListenerAdapter.newAdapter( configuration.getTransferListener() ) );
|
||||
artifactRequest.setTransferListener( configuration.getTransferListener() );
|
||||
|
||||
artifactResult = repositorySystem.resolve( artifactRequest );
|
||||
|
||||
|
@ -206,7 +205,7 @@ public class DefaultProjectBuilder
|
|||
.setRemoteRepositories( configuration.getRemoteRepositories() )
|
||||
.setOffline( configuration.isOffline() )
|
||||
.setForceUpdate( configuration.isForceUpdate() );
|
||||
request.setTransferListener( TransferListenerAdapter.newAdapter( configuration.getTransferListener() ) );
|
||||
request.setTransferListener( configuration.getTransferListener() );
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.apache.maven.model.resolution.InvalidRepositoryException;
|
|||
import org.apache.maven.model.resolution.ModelResolver;
|
||||
import org.apache.maven.model.resolution.UnresolvableModelException;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||
|
||||
/**
|
||||
* Implements a model resolver backed by the Maven Repository API and the reactor.
|
||||
|
@ -137,7 +136,7 @@ class RepositoryModelResolver
|
|||
request.setLocalRepository( projectBuildingRequest.getLocalRepository() );
|
||||
request.setOffline( projectBuildingRequest.isOffline() );
|
||||
request.setCache( projectBuildingRequest.getRepositoryCache() );
|
||||
request.setTransferListener( TransferListenerAdapter.newAdapter( projectBuildingRequest.getTransferListener() ) );
|
||||
request.setTransferListener( projectBuildingRequest.getTransferListener() );
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
||||
|
|
|
@ -542,6 +542,7 @@ public class MavenMetadataSource
|
|||
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
||||
configuration.setProcessPlugins( false );
|
||||
configuration.setSystemProperties( System.getProperties() );
|
||||
configuration.setTransferListener( repositoryRequest.getTransferListener() );
|
||||
|
||||
project = getProjectBuilder().build( pomArtifact, configuration ).getProject();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue