Skip to content

Commit

Permalink
Merge pull request #117 from jfdenise/master
Browse files Browse the repository at this point in the history
Fix for GAL-117, change mvn update NEVER_UPDATE policy to DAILY_UPDATE
  • Loading branch information
aloubyansky authored Aug 24, 2018
2 parents d4f1096 + d456ff7 commit ef12250
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 2 additions & 0 deletions cli/src/main/java/org/jboss/galleon/cli/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -59,13 +56,9 @@ private List<RemoteRepository> buildRepositories(MavenConfig config) throws Arti
List<RemoteRepository> 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;
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/tool/maven.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef12250

Please sign in to comment.