diff --git a/cli/src/main/java/org/jboss/galleon/cli/Util.java b/cli/src/main/java/org/jboss/galleon/cli/Util.java index 9e6cba421..045b96a1d 100644 --- a/cli/src/main/java/org/jboss/galleon/cli/Util.java +++ b/cli/src/main/java/org/jboss/galleon/cli/Util.java @@ -28,6 +28,7 @@ import org.eclipse.aether.impl.DefaultServiceLocator; import org.eclipse.aether.repository.LocalRepository; import org.eclipse.aether.repository.ProxySelector; +import static org.eclipse.aether.repository.RepositoryPolicy.UPDATE_POLICY_DAILY; import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; import org.eclipse.aether.spi.connector.transport.TransporterFactory; import org.eclipse.aether.transport.file.FileTransporterFactory; @@ -56,6 +57,7 @@ public static RepositorySystemSession newRepositorySession(final RepositorySyste session.setOffline(offline); final LocalRepository localRepo = new LocalRepository(path.toString()); session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo)); + session.setUpdatePolicy(UPDATE_POLICY_DAILY); if (proxySelector != null) { session.setProxySelector(proxySelector); } diff --git a/cli/src/main/java/org/jboss/galleon/cli/config/mvn/MavenCliSettings.java b/cli/src/main/java/org/jboss/galleon/cli/config/mvn/MavenCliSettings.java index b6d170177..1ee79ad35 100644 --- a/cli/src/main/java/org/jboss/galleon/cli/config/mvn/MavenCliSettings.java +++ b/cli/src/main/java/org/jboss/galleon/cli/config/mvn/MavenCliSettings.java @@ -23,9 +23,6 @@ import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.repository.RepositoryPolicy; -import static org.eclipse.aether.repository.RepositoryPolicy.CHECKSUM_POLICY_WARN; -import static org.eclipse.aether.repository.RepositoryPolicy.UPDATE_POLICY_NEVER; import org.jboss.galleon.ArtifactException; import org.jboss.galleon.cli.Util; @@ -59,13 +56,9 @@ private List buildRepositories(MavenConfig config) throws Arti List repos = new ArrayList<>(); for (MavenRemoteRepository repo : config.getRemoteRepositories()) { // The default policy for both snapshots and releases is to update daily. - // This shows very bad performance. Artifact are downloaded in an unpredictable way. - // We are never updating by default. - // XXX jfdenise, could be made configurable. + // This is required in order for the CLI to check in the remote repository for new releases. RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.getName(), repo.getType(), repo.getUrl()); - builder.setSnapshotPolicy(new RepositoryPolicy(true, UPDATE_POLICY_NEVER, CHECKSUM_POLICY_WARN)); - builder.setReleasePolicy(new RepositoryPolicy(true, UPDATE_POLICY_NEVER, CHECKSUM_POLICY_WARN)); repos.add(builder.build()); } return repos; diff --git a/docs/guide/tool/maven.adoc b/docs/guide/tool/maven.adoc index 2011ccdc9..c2e66b92c 100644 --- a/docs/guide/tool/maven.adoc +++ b/docs/guide/tool/maven.adoc @@ -20,7 +20,7 @@ Type the following commands: + _mvn add-repository --name=myrepo --url=http://foorepo_ + ### Repository policies (this could be made configurable) -Never update of local artifacts. + +Daily update. + Warn if checksum differs. ### Advanced maven configuration