mirror of https://github.com/apache/maven.git
o Re-added support for offline mode
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@803093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24bd8d772f
commit
217c82d26d
|
@ -31,12 +31,26 @@ public class DefaultRepositoryRequest
|
||||||
implements RepositoryRequest
|
implements RepositoryRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private boolean offline;
|
||||||
|
|
||||||
private ArtifactRepository localRepository;
|
private ArtifactRepository localRepository;
|
||||||
|
|
||||||
private List<ArtifactRepository> remoteRepositories;
|
private List<ArtifactRepository> remoteRepositories;
|
||||||
|
|
||||||
private RepositoryCache cache;
|
private RepositoryCache cache;
|
||||||
|
|
||||||
|
public boolean isOffline()
|
||||||
|
{
|
||||||
|
return offline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultRepositoryRequest setOffline( boolean offline )
|
||||||
|
{
|
||||||
|
this.offline = offline;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ArtifactRepository getLocalRepository()
|
public ArtifactRepository getLocalRepository()
|
||||||
{
|
{
|
||||||
return localRepository;
|
return localRepository;
|
||||||
|
|
|
@ -29,16 +29,64 @@ import java.util.List;
|
||||||
public interface RepositoryRequest
|
public interface RepositoryRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether network access to remote repositories has been disabled.
|
||||||
|
*
|
||||||
|
* @return {@code true} if remote access has been disabled, {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
boolean isOffline();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables/disables network access to remote repositories.
|
||||||
|
*
|
||||||
|
* @param offline {@code true} to disable remote access, {@code false} to allow network access.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
|
RepositoryRequest setOffline( boolean offline );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the local repository to use.
|
||||||
|
*
|
||||||
|
* @return The local repository to use or {@code null} if not set.
|
||||||
|
*/
|
||||||
ArtifactRepository getLocalRepository();
|
ArtifactRepository getLocalRepository();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the local repository to use.
|
||||||
|
*
|
||||||
|
* @param localRepository The local repository to use.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
RepositoryRequest setLocalRepository( ArtifactRepository localRepository );
|
RepositoryRequest setLocalRepository( ArtifactRepository localRepository );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the remote repositories to use.
|
||||||
|
*
|
||||||
|
* @return The remote repositories to use, never {@code null}.
|
||||||
|
*/
|
||||||
List<ArtifactRepository> getRemoteRepositories();
|
List<ArtifactRepository> getRemoteRepositories();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the remote repositories to use.
|
||||||
|
*
|
||||||
|
* @param remoteRepositories The remote repositories to use.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
RepositoryRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
RepositoryRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the repository cache to use.
|
||||||
|
*
|
||||||
|
* @return The repository cache to use or {@code null} if none.
|
||||||
|
*/
|
||||||
RepositoryCache getCache();
|
RepositoryCache getCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the repository cache to use.
|
||||||
|
*
|
||||||
|
* @param cache The repository cache to use, may be {@code null}.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
RepositoryRequest setCache( RepositoryCache cache );
|
RepositoryRequest setCache( RepositoryCache cache );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,52 +106,60 @@ public class DefaultRepositoryMetadataManager
|
||||||
ArtifactRepository localRepository = request.getLocalRepository();
|
ArtifactRepository localRepository = request.getLocalRepository();
|
||||||
List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();
|
List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();
|
||||||
|
|
||||||
for ( ArtifactRepository repository : remoteRepositories )
|
if ( !request.isOffline() )
|
||||||
{
|
{
|
||||||
ArtifactRepositoryPolicy policy = metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
|
for ( ArtifactRepository repository : remoteRepositories )
|
||||||
|
|
||||||
File file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, repository ) );
|
|
||||||
|
|
||||||
if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
|
|
||||||
{
|
{
|
||||||
getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() );
|
ArtifactRepositoryPolicy policy =
|
||||||
try
|
metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
|
||||||
{
|
|
||||||
wagonManager.getArtifactMetadata( metadata, repository, file, policy.getChecksumPolicy() );
|
|
||||||
}
|
|
||||||
catch ( ResourceDoesNotExistException e )
|
|
||||||
{
|
|
||||||
getLogger().debug( metadata + " could not be found on repository: " + repository.getId() );
|
|
||||||
|
|
||||||
// delete the local copy so the old details aren't used.
|
File file =
|
||||||
if ( file.exists() )
|
new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata,
|
||||||
|
repository ) );
|
||||||
|
|
||||||
|
if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
|
||||||
|
{
|
||||||
|
getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() );
|
||||||
|
try
|
||||||
{
|
{
|
||||||
file.delete();
|
wagonManager.getArtifactMetadata( metadata, repository, file, policy.getChecksumPolicy() );
|
||||||
|
}
|
||||||
|
catch ( ResourceDoesNotExistException e )
|
||||||
|
{
|
||||||
|
getLogger().debug( metadata + " could not be found on repository: " + repository.getId() );
|
||||||
|
|
||||||
|
// delete the local copy so the old details aren't used.
|
||||||
|
if ( file.exists() )
|
||||||
|
{
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( TransferFailedException e )
|
||||||
|
{
|
||||||
|
getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId()
|
||||||
|
+ " due to an error: " + e.getMessage() );
|
||||||
|
getLogger().debug( "Exception", e );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
updateCheckManager.touch( metadata, repository, file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( TransferFailedException e )
|
else
|
||||||
{
|
{
|
||||||
getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId() + " due to an error: " + e.getMessage() );
|
getLogger().debug( "Skipping metadata update of " + metadata.getKey() + " from "
|
||||||
getLogger().debug( "Exception", e );
|
+ repository.getId() );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
updateCheckManager.touch( metadata, repository, file );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getLogger().debug( "Skipping metadata update of " + metadata.getKey() + " from " + repository.getId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: should this be inside the above check?
|
// TODO: should this be inside the above check?
|
||||||
// touch file so that this is not checked again until interval has passed
|
// touch file so that this is not checked again until interval has passed
|
||||||
if ( file.exists() )
|
if ( file.exists() )
|
||||||
{
|
{
|
||||||
file.setLastModified( System.currentTimeMillis() );
|
file.setLastModified( System.currentTimeMillis() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mergeMetadata( metadata, remoteRepositories, localRepository );
|
mergeMetadata( metadata, remoteRepositories, localRepository );
|
||||||
|
|
|
@ -68,6 +68,8 @@ public class ArtifactResolutionRequest
|
||||||
|
|
||||||
private boolean resolveTransitively = false;
|
private boolean resolveTransitively = false;
|
||||||
|
|
||||||
|
private boolean offline;
|
||||||
|
|
||||||
public ArtifactResolutionRequest()
|
public ArtifactResolutionRequest()
|
||||||
{
|
{
|
||||||
// nothing here
|
// nothing here
|
||||||
|
@ -78,6 +80,7 @@ public class ArtifactResolutionRequest
|
||||||
setLocalRepository( request.getLocalRepository() );
|
setLocalRepository( request.getLocalRepository() );
|
||||||
setRemoteRepositories( request.getRemoteRepositories() );
|
setRemoteRepositories( request.getRemoteRepositories() );
|
||||||
setCache( request.getCache() );
|
setCache( request.getCache() );
|
||||||
|
setOffline( request.isOffline() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Artifact getArtifact()
|
public Artifact getArtifact()
|
||||||
|
@ -230,4 +233,16 @@ public class ArtifactResolutionRequest
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOffline()
|
||||||
|
{
|
||||||
|
return offline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactResolutionRequest setOffline( boolean offline )
|
||||||
|
{
|
||||||
|
this.offline = offline;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class DefaultArtifactResolver
|
||||||
|
|
||||||
destination = artifact.getFile();
|
destination = artifact.getFile();
|
||||||
|
|
||||||
if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) )
|
if ( ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) ) && !request.isOffline() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -175,12 +175,6 @@ public class DefaultArtifactResolver
|
||||||
{
|
{
|
||||||
wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor );
|
wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !artifact.isResolved() && !destination.exists() )
|
|
||||||
{
|
|
||||||
throw new ArtifactResolutionException( "Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",
|
|
||||||
artifact, remoteRepositories );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( ResourceDoesNotExistException e )
|
catch ( ResourceDoesNotExistException e )
|
||||||
{
|
{
|
||||||
|
@ -196,6 +190,20 @@ public class DefaultArtifactResolver
|
||||||
{
|
{
|
||||||
artifact.setResolved( true );
|
artifact.setResolved( true );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( request.isOffline() )
|
||||||
|
{
|
||||||
|
throw new ArtifactResolutionException( "The repository system is offline"
|
||||||
|
+ " and the requested artifact is not locally available", artifact, remoteRepositories );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ArtifactResolutionException( "Failed to resolve artifact, possibly due to a "
|
||||||
|
+ "repository list that is not appropriately equipped for this artifact's metadata.", artifact,
|
||||||
|
remoteRepositories );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 1.0-SNAPSHOT
|
// 1.0-SNAPSHOT
|
||||||
//
|
//
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.repository.legacy.metadata;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
@ -45,6 +46,8 @@ public class DefaultMetadataResolutionRequest
|
||||||
|
|
||||||
private boolean resolveManagedVersions;
|
private boolean resolveManagedVersions;
|
||||||
|
|
||||||
|
private boolean offline;
|
||||||
|
|
||||||
public DefaultMetadataResolutionRequest()
|
public DefaultMetadataResolutionRequest()
|
||||||
{
|
{
|
||||||
// does nothing
|
// does nothing
|
||||||
|
@ -55,6 +58,7 @@ public class DefaultMetadataResolutionRequest
|
||||||
setLocalRepository( request.getLocalRepository() );
|
setLocalRepository( request.getLocalRepository() );
|
||||||
setRemoteRepositories( request.getRemoteRepositories() );
|
setRemoteRepositories( request.getRemoteRepositories() );
|
||||||
setCache( request.getCache() );
|
setCache( request.getCache() );
|
||||||
|
setOffline( request.isOffline() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Artifact getArtifact()
|
public Artifact getArtifact()
|
||||||
|
@ -83,6 +87,11 @@ public class DefaultMetadataResolutionRequest
|
||||||
|
|
||||||
public List<ArtifactRepository> getRemoteRepositories()
|
public List<ArtifactRepository> getRemoteRepositories()
|
||||||
{
|
{
|
||||||
|
if ( remoteRepositories == null )
|
||||||
|
{
|
||||||
|
remoteRepositories = new ArrayList<ArtifactRepository>();
|
||||||
|
}
|
||||||
|
|
||||||
return remoteRepositories;
|
return remoteRepositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,9 +107,10 @@ public class DefaultMetadataResolutionRequest
|
||||||
return resolveManagedVersions;
|
return resolveManagedVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions )
|
public DefaultMetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions )
|
||||||
{
|
{
|
||||||
this.resolveManagedVersions = resolveManagedVersions;
|
this.resolveManagedVersions = resolveManagedVersions;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,11 +119,23 @@ public class DefaultMetadataResolutionRequest
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataResolutionRequest setCache( RepositoryCache cache )
|
public DefaultMetadataResolutionRequest setCache( RepositoryCache cache )
|
||||||
{
|
{
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOffline()
|
||||||
|
{
|
||||||
|
return offline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultMetadataResolutionRequest setOffline( boolean offline )
|
||||||
|
{
|
||||||
|
this.offline = offline;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.repository.RepositoryRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +35,21 @@ public interface MetadataResolutionRequest
|
||||||
extends RepositoryRequest
|
extends RepositoryRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether network access to remote repositories has been disabled.
|
||||||
|
*
|
||||||
|
* @return {@code true} if remote access has been disabled, {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
boolean isOffline();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables/disables network access to remote repositories.
|
||||||
|
*
|
||||||
|
* @param offline {@code true} to disable remote access, {@code false} to allow network access.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
|
MetadataResolutionRequest setOffline( boolean offline );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the artifact to resolve metadata for.
|
* Gets the artifact to resolve metadata for.
|
||||||
*
|
*
|
||||||
|
@ -67,18 +83,33 @@ public interface MetadataResolutionRequest
|
||||||
/**
|
/**
|
||||||
* Gets the remote repositories to use for the resolution.
|
* Gets the remote repositories to use for the resolution.
|
||||||
*
|
*
|
||||||
* @return The remote repositories to use for the resolution or {@code null} if not set.
|
* @return The remote repositories to use for the resolution, never {@code null}.
|
||||||
*/
|
*/
|
||||||
List<ArtifactRepository> getRemoteRepositories();
|
List<ArtifactRepository> getRemoteRepositories();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the remote repository to use for the resolution.
|
* Sets the remote repositories to use for the resolution.
|
||||||
*
|
*
|
||||||
* @param remoteRepositories The remote repository to use for the resolution.
|
* @param remoteRepositories The remote repositories to use for the resolution.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
MetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
MetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the repository cache to use.
|
||||||
|
*
|
||||||
|
* @return The repository cache to use or {@code null} if none.
|
||||||
|
*/
|
||||||
|
RepositoryCache getCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the repository cache to use.
|
||||||
|
*
|
||||||
|
* @param cache The repository cache to use, may be {@code null}.
|
||||||
|
* @return This request, never {@code null}.
|
||||||
|
*/
|
||||||
|
MetadataResolutionRequest setCache( RepositoryCache cache );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the managed version information should be retrieved.
|
* Determines whether the managed version information should be retrieved.
|
||||||
*
|
*
|
||||||
|
|
|
@ -898,6 +898,7 @@ public class DefaultMavenExecutionRequest
|
||||||
projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
|
projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
|
||||||
projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
|
projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
|
||||||
projectBuildingRequest.setRepositoryCache( getRepositoryCache() );
|
projectBuildingRequest.setRepositoryCache( getRepositoryCache() );
|
||||||
|
projectBuildingRequest.setOffline( isOffline() );
|
||||||
projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
|
projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
|
||||||
projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
|
projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
|
||||||
projectBuildingRequest.setProfiles( getProfiles() );
|
projectBuildingRequest.setProfiles( getProfiles() );
|
||||||
|
|
|
@ -156,9 +156,7 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
MavenExecutionResult result = session.getResult();
|
MavenExecutionResult result = session.getResult();
|
||||||
|
|
||||||
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
RepositoryRequest repositoryRequest = getRepositoryRequest( session, null );
|
||||||
repositoryRequest.setLocalRepository( session.getLocalRepository() );
|
|
||||||
repositoryRequest.setCache( session.getRepositoryCache() );
|
|
||||||
|
|
||||||
for ( MavenProject currentProject : session.getProjects() )
|
for ( MavenProject currentProject : session.getProjects() )
|
||||||
{
|
{
|
||||||
|
@ -366,7 +364,11 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
request.setCache( session.getRepositoryCache() );
|
request.setCache( session.getRepositoryCache() );
|
||||||
request.setLocalRepository( session.getLocalRepository() );
|
request.setLocalRepository( session.getLocalRepository() );
|
||||||
request.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
if ( project != null )
|
||||||
|
{
|
||||||
|
request.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
||||||
|
}
|
||||||
|
request.setOffline( session.isOffline() );
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,6 +422,7 @@ public class DefaultPluginManager
|
||||||
request.setLocalRepository( localRepository );
|
request.setLocalRepository( localRepository );
|
||||||
request.setRemoteRepositories( remoteRepositories );
|
request.setRemoteRepositories( remoteRepositories );
|
||||||
request.setCache( session.getRepositoryCache() );
|
request.setCache( session.getRepositoryCache() );
|
||||||
|
request.setOffline( session.isOffline() );
|
||||||
pluginArtifacts = getPluginArtifacts( pluginArtifact, plugin, request );
|
pluginArtifacts = getPluginArtifacts( pluginArtifact, plugin, request );
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
catch ( ArtifactNotFoundException e )
|
||||||
|
|
|
@ -167,6 +167,7 @@ public class DefaultProjectBuilder
|
||||||
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
||||||
repositoryRequest.setCache( configuration.getRepositoryCache() );
|
repositoryRequest.setCache( configuration.getRepositoryCache() );
|
||||||
repositoryRequest.setLocalRepository( configuration.getLocalRepository() );
|
repositoryRequest.setLocalRepository( configuration.getLocalRepository() );
|
||||||
|
repositoryRequest.setOffline( configuration.isOffline() );
|
||||||
|
|
||||||
ModelResolver resolver =
|
ModelResolver resolver =
|
||||||
new RepositoryModelResolver( repositorySystem, resolutionErrorHandler, repositoryRequest,
|
new RepositoryModelResolver( repositorySystem, resolutionErrorHandler, repositoryRequest,
|
||||||
|
@ -504,6 +505,7 @@ public class DefaultProjectBuilder
|
||||||
repositoryRequest.setLocalRepository( configuration.getLocalRepository() );
|
repositoryRequest.setLocalRepository( configuration.getLocalRepository() );
|
||||||
repositoryRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
repositoryRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
|
||||||
repositoryRequest.setCache( configuration.getRepositoryCache() );
|
repositoryRequest.setCache( configuration.getRepositoryCache() );
|
||||||
|
repositoryRequest.setOffline( configuration.isOffline() );
|
||||||
|
|
||||||
lifecycle.populateDefaultConfigurationForPlugins( model.getBuild().getPlugins(), repositoryRequest );
|
lifecycle.populateDefaultConfigurationForPlugins( model.getBuild().getPlugins(), repositoryRequest );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ public class DefaultProjectBuildingRequest
|
||||||
implements ProjectBuildingRequest
|
implements ProjectBuildingRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private boolean offline;
|
||||||
|
|
||||||
private RepositoryCache repositoryCache;
|
private RepositoryCache repositoryCache;
|
||||||
|
|
||||||
private ArtifactRepository localRepository;
|
private ArtifactRepository localRepository;
|
||||||
|
@ -84,6 +86,18 @@ public class DefaultProjectBuildingRequest
|
||||||
this.topProject = mavenProject;
|
this.topProject = mavenProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DefaultProjectBuildingRequest setOffline( boolean offline )
|
||||||
|
{
|
||||||
|
this.offline = offline;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOffline()
|
||||||
|
{
|
||||||
|
return offline;
|
||||||
|
}
|
||||||
|
|
||||||
public ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache )
|
public ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache )
|
||||||
{
|
{
|
||||||
this.repositoryCache = repositoryCache;
|
this.repositoryCache = repositoryCache;
|
||||||
|
|
|
@ -33,6 +33,10 @@ import org.apache.maven.wagon.events.TransferListener;
|
||||||
public interface ProjectBuildingRequest
|
public interface ProjectBuildingRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ProjectBuildingRequest setOffline( boolean offline );
|
||||||
|
|
||||||
|
boolean isOffline();
|
||||||
|
|
||||||
ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache );
|
ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache );
|
||||||
|
|
||||||
RepositoryCache getRepositoryCache();
|
RepositoryCache getRepositoryCache();
|
||||||
|
|
|
@ -469,6 +469,7 @@ public class MavenMetadataSource
|
||||||
configuration.setRepositoryCache( repositoryRequest.getCache() );
|
configuration.setRepositoryCache( repositoryRequest.getCache() );
|
||||||
configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
|
configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
|
||||||
configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
|
configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
|
||||||
|
configuration.setOffline( repositoryRequest.isOffline() );
|
||||||
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
||||||
configuration.setProcessPlugins( false );
|
configuration.setProcessPlugins( false );
|
||||||
configuration.setSystemProperties( System.getProperties() );
|
configuration.setSystemProperties( System.getProperties() );
|
||||||
|
|
Loading…
Reference in New Issue