[MNG-4679] [regression] command line option "-update-snapshots" does not work for dependency:copy-dependencies

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@945715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-05-18 15:49:14 +00:00
parent bdecdcf64a
commit 40028e7a18
2 changed files with 8 additions and 10 deletions

View File

@ -135,28 +135,25 @@ public class DefaultArtifactResolver
} }
} }
private void injectSession( RepositoryRequest request ) private void injectSession1( RepositoryRequest request, MavenSession session )
{ {
MavenSession session = legacySupport.getSession();
if ( session != null ) if ( session != null )
{ {
request.setOffline( session.isOffline() ); request.setOffline( session.isOffline() );
request.setForceUpdate( session.getRequest().isUpdateSnapshots() );
request.setTransferListener( session.getRequest().getTransferListener() ); request.setTransferListener( session.getRequest().getTransferListener() );
} }
} }
private void injectSession( ArtifactResolutionRequest request ) private void injectSession2( ArtifactResolutionRequest request, MavenSession session )
{ {
MavenSession session = legacySupport.getSession(); injectSession1( request, session );
if ( session != null ) if ( session != null )
{ {
request.setOffline( session.isOffline() );
request.setServers( session.getRequest().getServers() ); request.setServers( session.getRequest().getServers() );
request.setMirrors( session.getRequest().getMirrors() ); request.setMirrors( session.getRequest().getMirrors() );
request.setProxies( session.getRequest().getProxies() ); request.setProxies( session.getRequest().getProxies() );
request.setTransferListener( session.getRequest().getTransferListener() );
} }
} }
@ -164,7 +161,7 @@ public class DefaultArtifactResolver
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
injectSession( request ); injectSession1( request, legacySupport.getSession() );
request.setLocalRepository( localRepository ); request.setLocalRepository( localRepository );
request.setRemoteRepositories( remoteRepositories ); request.setRemoteRepositories( remoteRepositories );
resolve( artifact, request, resolutionListener, false ); resolve( artifact, request, resolutionListener, false );
@ -174,7 +171,7 @@ public class DefaultArtifactResolver
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
injectSession( request ); injectSession1( request, legacySupport.getSession() );
request.setLocalRepository( localRepository ); request.setLocalRepository( localRepository );
request.setRemoteRepositories( remoteRepositories ); request.setRemoteRepositories( remoteRepositories );
resolve( artifact, request, null, true ); resolve( artifact, request, null, true );
@ -435,7 +432,7 @@ public class DefaultArtifactResolver
.setCollectionFilter( filter ) .setCollectionFilter( filter )
.setListeners( listeners ); .setListeners( listeners );
injectSession( request ); injectSession2( request, legacySupport.getSession() );
return resolveWithExceptions( request ); return resolveWithExceptions( request );
} }

View File

@ -79,6 +79,7 @@ public class DefaultLegacyArtifactCollector
if ( session != null ) if ( session != null )
{ {
request.setOffline( session.isOffline() ); request.setOffline( session.isOffline() );
request.setForceUpdate( session.getRequest().isUpdateSnapshots() );
request.setServers( session.getRequest().getServers() ); request.setServers( session.getRequest().getServers() );
request.setMirrors( session.getRequest().getMirrors() ); request.setMirrors( session.getRequest().getMirrors() );
request.setProxies( session.getRequest().getProxies() ); request.setProxies( session.getRequest().getProxies() );