use of org.eclipse.aether.repository.RepositoryPolicy in project fabric8 by jboss-fuse.
the class AetherBasedResolver method addRepo.
private void addRepo(List<RemoteRepository> list, MavenRepositoryURL repo) {
String releasesUpdatePolicy = repo.getReleasesUpdatePolicy();
if (releasesUpdatePolicy == null || releasesUpdatePolicy.isEmpty()) {
releasesUpdatePolicy = new RepositoryPolicy().getUpdatePolicy();
}
String releasesChecksumPolicy = repo.getReleasesChecksumPolicy();
if (releasesChecksumPolicy == null || releasesChecksumPolicy.isEmpty()) {
releasesChecksumPolicy = new RepositoryPolicy().getChecksumPolicy();
}
String snapshotsUpdatePolicy = repo.getSnapshotsUpdatePolicy();
if (snapshotsUpdatePolicy == null || snapshotsUpdatePolicy.isEmpty()) {
snapshotsUpdatePolicy = new RepositoryPolicy().getUpdatePolicy();
}
String snapshotsChecksumPolicy = repo.getSnapshotsChecksumPolicy();
if (snapshotsChecksumPolicy == null || snapshotsChecksumPolicy.isEmpty()) {
snapshotsChecksumPolicy = new RepositoryPolicy().getChecksumPolicy();
}
RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.getId(), REPO_TYPE, repo.getURL().toExternalForm());
RepositoryPolicy releasePolicy = new RepositoryPolicy(repo.isReleasesEnabled(), releasesUpdatePolicy, releasesChecksumPolicy);
builder.setReleasePolicy(releasePolicy);
RepositoryPolicy snapshotPolicy = new RepositoryPolicy(repo.isSnapshotsEnabled(), snapshotsUpdatePolicy, snapshotsChecksumPolicy);
builder.setSnapshotPolicy(snapshotPolicy);
Authentication authentication = getAuthentication(repo.getId());
if (authentication != null) {
builder.setAuthentication(authentication);
}
list.add(builder.build());
}
use of org.eclipse.aether.repository.RepositoryPolicy in project wildfly-swarm by wildfly-swarm.
the class MavenArtifactResolvingHelperTest method propagateRepositoryPolicies.
@Test
public // SWARM-1173: swarm-plugin trying to download SNAPSHOTs from Maven Central
void propagateRepositoryPolicies() {
RepositorySystemSession sessionMock = Mockito.mock(RepositorySystemSession.class);
MirrorSelector mirrorSelectorMock = Mockito.mock(MirrorSelector.class);
Mockito.when(sessionMock.getMirrorSelector()).thenReturn(mirrorSelectorMock);
ProxySelector proxySelectorMock = Mockito.mock(ProxySelector.class);
Mockito.when(sessionMock.getProxySelector()).thenReturn(proxySelectorMock);
MavenArtifactResolvingHelper artifactResolverHelper = new MavenArtifactResolvingHelper(null, null, sessionMock, null);
ArtifactRepositoryPolicy testSnapshotPolicy = new ArtifactRepositoryPolicy(false, "hourly", "warn");
ArtifactRepositoryPolicy testReleasesPolicy = new ArtifactRepositoryPolicy(true, "never", "warn");
ArtifactRepository testingRepo = new MavenArtifactRepository("testing-repo", "http://testing-repo.org", new DefaultRepositoryLayout(), testSnapshotPolicy, testReleasesPolicy);
artifactResolverHelper.remoteRepository(testingRepo);
List<RemoteRepository> remoteRepos = artifactResolverHelper.getRemoteRepositories();
Assert.assertTrue("Remote repositories " + remoteRepos + " do not contain expected testing repo " + testingRepo, remoteRepos.stream().anyMatch(remoteRepo -> {
RepositoryPolicy snapshotsPolicy = remoteRepo.getPolicy(true);
RepositoryPolicy releasesPolicy = remoteRepo.getPolicy(false);
return remoteRepo.getId().equals(testingRepo.getId()) && !snapshotsPolicy.isEnabled() && snapshotsPolicy.getUpdatePolicy().equals(testSnapshotPolicy.getUpdatePolicy()) && snapshotsPolicy.getChecksumPolicy().equals(testSnapshotPolicy.getChecksumPolicy()) && releasesPolicy.isEnabled() && releasesPolicy.getUpdatePolicy().equals(testReleasesPolicy.getUpdatePolicy()) && releasesPolicy.getChecksumPolicy().equals(testReleasesPolicy.getChecksumPolicy());
}));
}
use of org.eclipse.aether.repository.RepositoryPolicy in project spring-boot by spring-projects.
the class MavenResolverGrapeEngineFactory method createRepositories.
private static List<RemoteRepository> createRepositories(List<RepositoryConfiguration> repositoryConfigurations) {
List<RemoteRepository> repositories = new ArrayList<>(repositoryConfigurations.size());
for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) {
RemoteRepository.Builder builder = new RemoteRepository.Builder(repositoryConfiguration.getName(), "default", repositoryConfiguration.getUri().toASCIIString());
if (!repositoryConfiguration.getSnapshotsEnabled()) {
builder.setSnapshotPolicy(new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_IGNORE));
}
repositories.add(builder.build());
}
return repositories;
}
use of org.eclipse.aether.repository.RepositoryPolicy in project zeppelin by apache.
the class AbstractDependencyResolver method addRepo.
public void addRepo(String id, String url, boolean snapshot) {
synchronized (repos) {
delRepo(id);
RepositoryPolicy policy = new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN);
RemoteRepository.Builder rr = new RemoteRepository.Builder(id, "default", url);
if (snapshot) {
rr.setSnapshotPolicy(policy);
} else {
rr.setPolicy(policy);
}
if (proxy != null) {
rr.setProxy(proxy);
}
repos.add(rr.build());
}
}
use of org.eclipse.aether.repository.RepositoryPolicy in project zeppelin by apache.
the class AbstractDependencyResolver method addRepo.
public void addRepo(String id, String url, boolean snapshot, Authentication auth, Proxy proxy) {
synchronized (repos) {
delRepo(id);
RepositoryPolicy policy = new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN);
RemoteRepository.Builder rr = new RemoteRepository.Builder(id, "default", url).setAuthentication(auth).setProxy(proxy);
if (snapshot) {
rr.setSnapshotPolicy(policy);
} else {
rr.setPolicy(policy);
}
repos.add(rr.build());
}
}
Aggregations