From 68ebd39bd845b7e67a2830839e19d8c01a50a6ab Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 9 Sep 2010 22:52:57 +0000 Subject: [PATCH] [MNG-4343] maven always checks missing release artifacts [MNG-4592] Snapshot artifacts that could not be downloaded due to communication problems are "blacklisted" for a day by default. o Allowed to configure caching of resolution errors in the execution request, thereby providing better control for CLI and IDE to select the desired behavior git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@995600 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/maven/DefaultMaven.java | 4 +-- .../DefaultMavenExecutionRequest.java | 28 +++++++++++++++++++ .../execution/MavenExecutionRequest.java | 6 ++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 311678790c..915165f436 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -345,8 +345,8 @@ public class DefaultMaven session.setChecksumPolicy( request.getGlobalChecksumPolicy() ); session.setUpdatePolicy( request.isUpdateSnapshots() ? RepositoryPolicy.UPDATE_POLICY_ALWAYS : null ); - session.setNotFoundCachingEnabled( !request.isUpdateSnapshots() ); - session.setTransferErrorCachingEnabled( !request.isUpdateSnapshots() ); + session.setNotFoundCachingEnabled( request.isCacheNotFound() ); + session.setTransferErrorCachingEnabled( request.isCacheTransferError() ); session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) ); diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 4a01e38f6a..7cb2274a90 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -56,6 +56,10 @@ public class DefaultMavenExecutionRequest private boolean interactiveMode = true; + private boolean cacheTransferError = true; + + private boolean cacheNotFound = true; + private List proxies; private List servers; @@ -150,6 +154,8 @@ public class DefaultMavenExecutionRequest copy.setLocalRepositoryPath( original.getLocalRepositoryPath() ); copy.setOffline( original.isOffline() ); copy.setInteractiveMode( original.isInteractiveMode() ); + copy.setCacheNotFound( original.isCacheNotFound() ); + copy.setCacheTransferError( original.isCacheTransferError() ); copy.setProxies( original.getProxies() ); copy.setServers( original.getServers() ); copy.setMirrors( original.getMirrors() ); @@ -1048,4 +1054,26 @@ public class DefaultMavenExecutionRequest return this; } + public boolean isCacheTransferError() + { + return cacheTransferError; + } + + public MavenExecutionRequest setCacheTransferError( boolean cacheTransferError ) + { + this.cacheTransferError = cacheTransferError; + return this; + } + + public boolean isCacheNotFound() + { + return cacheNotFound; + } + + public MavenExecutionRequest setCacheNotFound( boolean cacheNotFound ) + { + this.cacheNotFound = cacheNotFound; + return this; + } + } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index c66cd3ad85..fcf6eeaf98 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -204,6 +204,12 @@ public interface MavenExecutionRequest MavenExecutionRequest setOffline( boolean offline ); boolean isOffline(); + boolean isCacheTransferError(); + MavenExecutionRequest setCacheTransferError( boolean cacheTransferError ); + + boolean isCacheNotFound(); + MavenExecutionRequest setCacheNotFound( boolean cacheNotFound ); + // Profiles List getProfiles(); MavenExecutionRequest addProfile( Profile profile );