mirror of https://github.com/apache/maven.git
[MNG-4361] [regression] command line option "-update-snapshots" does not work
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@816002 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b98795ecb9
commit
5d459b0c0e
|
@ -33,6 +33,8 @@ public class DefaultRepositoryRequest
|
|||
|
||||
private boolean offline;
|
||||
|
||||
private boolean forceUpdate;
|
||||
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
private List<ArtifactRepository> remoteRepositories;
|
||||
|
@ -58,6 +60,7 @@ public class DefaultRepositoryRequest
|
|||
setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
|
||||
setOffline( repositoryRequest.isOffline() );
|
||||
setCache( repositoryRequest.getCache() );
|
||||
setForceUpdate( repositoryRequest.isForceUpdate() );
|
||||
}
|
||||
|
||||
public boolean isOffline()
|
||||
|
@ -72,6 +75,18 @@ public class DefaultRepositoryRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return forceUpdate;
|
||||
}
|
||||
|
||||
public DefaultRepositoryRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
this.forceUpdate = forceUpdate;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ArtifactRepository getLocalRepository()
|
||||
{
|
||||
return localRepository;
|
||||
|
|
|
@ -44,6 +44,24 @@ public interface RepositoryRequest
|
|||
*/
|
||||
RepositoryRequest setOffline( boolean offline );
|
||||
|
||||
/**
|
||||
* Indicates whether remote repositories should be re-checked for updated artifacts/metadata regardless of their
|
||||
* configured update policy.
|
||||
*
|
||||
* @return {@code true} if remote repositories should be re-checked for updated artifacts/metadata, {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
boolean isForceUpdate();
|
||||
|
||||
/**
|
||||
* Enables/disabled forced checks for updated artifacts/metadata on remote repositories.
|
||||
*
|
||||
* @param forceUpdate {@code true} to forcibly check the remote repositories for updated artifacts/metadata, {@code
|
||||
* false} to use the update policy configured on each repository.
|
||||
* @return This request, never {@code null}.
|
||||
*/
|
||||
RepositoryRequest setForceUpdate( boolean forceUpdate );
|
||||
|
||||
/**
|
||||
* Gets the local repository to use.
|
||||
*
|
||||
|
|
|
@ -117,7 +117,8 @@ public class DefaultRepositoryMetadataManager
|
|||
new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata,
|
||||
repository ) );
|
||||
|
||||
if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
|
||||
if ( ( policy.isEnabled() && request.isForceUpdate() )
|
||||
|| updateCheckManager.isUpdateRequired( metadata, repository, file ) )
|
||||
{
|
||||
getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() );
|
||||
try
|
||||
|
|
|
@ -72,6 +72,8 @@ public class ArtifactResolutionRequest
|
|||
|
||||
private boolean offline;
|
||||
|
||||
private boolean forceUpdate;
|
||||
|
||||
public ArtifactResolutionRequest()
|
||||
{
|
||||
// nothing here
|
||||
|
@ -83,6 +85,7 @@ public class ArtifactResolutionRequest
|
|||
setRemoteRepositories( request.getRemoteRepositories() );
|
||||
setCache( request.getCache() );
|
||||
setOffline( request.isOffline() );
|
||||
setForceUpdate( request.isForceUpdate() );
|
||||
}
|
||||
|
||||
public Artifact getArtifact()
|
||||
|
@ -272,4 +275,16 @@ public class ArtifactResolutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return forceUpdate;
|
||||
}
|
||||
|
||||
public ArtifactResolutionRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
this.forceUpdate = forceUpdate;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,4 +124,16 @@ public class DefaultMetadataResolutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return repositoryRequest.isForceUpdate();
|
||||
}
|
||||
|
||||
public DefaultMetadataResolutionRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
repositoryRequest.setForceUpdate( forceUpdate );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public class DefaultProjectDependenciesResolver
|
|||
.setResolutionFilter( resolutionScopeFilter )
|
||||
.setLocalRepository( session.getLocalRepository() )
|
||||
.setOffline( session.isOffline() )
|
||||
.setForceUpdate( session.getRequest().isUpdateSnapshots() )
|
||||
.setCache( session.getRepositoryCache() );
|
||||
// FIXME setTransferListener
|
||||
|
||||
|
|
|
@ -164,4 +164,16 @@ public class DefaultPluginPrefixRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return repositoryRequest.isForceUpdate();
|
||||
}
|
||||
|
||||
public DefaultPluginPrefixRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
repositoryRequest.setForceUpdate( forceUpdate );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -131,4 +131,16 @@ public class DefaultPluginVersionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return repositoryRequest.isForceUpdate();
|
||||
}
|
||||
|
||||
public DefaultPluginVersionRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
repositoryRequest.setForceUpdate( forceUpdate );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public class DefaultProjectBuilder
|
|||
.setLocalRepository( configuration.getLocalRepository() )
|
||||
.setRemoteRepositories( project.getRemoteArtifactRepositories() )
|
||||
.setOffline( configuration.isOffline() )
|
||||
.setForceUpdate( configuration.isForceUpdate() )
|
||||
.setManagedVersionMap( project.getManagedVersionMap() );
|
||||
// FIXME setTransferListener
|
||||
|
||||
|
@ -195,7 +196,8 @@ public class DefaultProjectBuilder
|
|||
.setCache( configuration.getRepositoryCache() )
|
||||
.setLocalRepository( configuration.getLocalRepository() )
|
||||
.setRemoteRepositories( configuration.getRemoteRepositories() )
|
||||
.setOffline( configuration.isOffline() );
|
||||
.setOffline( configuration.isOffline() )
|
||||
.setForceUpdate( configuration.isForceUpdate() );
|
||||
// FIXME setTransferListener
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DefaultProjectBuildingRequest
|
|||
|
||||
private boolean offline;
|
||||
|
||||
private boolean forceUpdate;
|
||||
|
||||
private RepositoryCache repositoryCache;
|
||||
|
||||
private ArtifactRepository localRepository;
|
||||
|
@ -112,6 +114,18 @@ public class DefaultProjectBuildingRequest
|
|||
return offline;
|
||||
}
|
||||
|
||||
public boolean isForceUpdate()
|
||||
{
|
||||
return forceUpdate;
|
||||
}
|
||||
|
||||
public ProjectBuildingRequest setForceUpdate( boolean forceUpdate )
|
||||
{
|
||||
this.forceUpdate = forceUpdate;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache )
|
||||
{
|
||||
this.repositoryCache = repositoryCache;
|
||||
|
|
|
@ -38,6 +38,10 @@ public interface ProjectBuildingRequest
|
|||
|
||||
boolean isOffline();
|
||||
|
||||
ProjectBuildingRequest setForceUpdate( boolean forceUpdate );
|
||||
|
||||
boolean isForceUpdate();
|
||||
|
||||
ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache );
|
||||
|
||||
RepositoryCache getRepositoryCache();
|
||||
|
|
|
@ -525,6 +525,7 @@ public class MavenMetadataSource
|
|||
configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
|
||||
configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
|
||||
configuration.setOffline( repositoryRequest.isOffline() );
|
||||
configuration.setForceUpdate( repositoryRequest.isForceUpdate() );
|
||||
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
||||
configuration.setProcessPlugins( false );
|
||||
configuration.setSystemProperties( System.getProperties() );
|
||||
|
|
Loading…
Reference in New Issue