Allow use of snapshot repos to be disabled
Previously, the Ivy-based Grape engine used a system property, disableSpringSnapshotRepos, to control whether or not Spring's snapshot and milestone repositories were used for dependency resolution. This commit adds the same capability to AetherGrapeEngine. [#59489826]
This commit is contained in:
parent
629a77c3e2
commit
4f47f71dc2
|
@ -148,12 +148,18 @@ public class AetherGrapeEngine implements GrapeEngine {
|
|||
|
||||
this.repositorySystemSession = repositorySystemSession;
|
||||
|
||||
this.repositories = Arrays.asList(new RemoteRepository.Builder("central",
|
||||
"default", "http://repo1.maven.org/maven2/").build(),
|
||||
new RemoteRepository.Builder("spring-snapshot", "default",
|
||||
"http://repo.spring.io/snapshot").build(),
|
||||
new RemoteRepository.Builder("spring-milestone", "default",
|
||||
"http://repo.spring.io/milestone").build());
|
||||
List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
|
||||
repositories.add(new RemoteRepository.Builder("central", "default",
|
||||
"http://repo1.maven.org/maven2/").build());
|
||||
|
||||
if (!Boolean.getBoolean("disableSpringSnapshotRepos")) {
|
||||
repositories.add(new RemoteRepository.Builder("spring-snapshot", "default",
|
||||
"http://repo.spring.io/snapshot").build());
|
||||
repositories.add(new RemoteRepository.Builder("spring-milestone", "default",
|
||||
"http://repo.spring.io/milestone").build());
|
||||
}
|
||||
|
||||
this.repositories = repositories;
|
||||
|
||||
this.artifactDescriptorReader = mavenServiceLocator
|
||||
.getService(ArtifactDescriptorReader.class);
|
||||
|
|
|
@ -70,6 +70,19 @@ public class AetherGrapeEngineTests {
|
|||
assertEquals(6, customClassLoader.getURLs().length);
|
||||
}
|
||||
|
||||
@Test(expected = DependencyResolutionFailedException.class)
|
||||
public void resolutionWithSnapshotRepositoriesDisabled() {
|
||||
Map<String, Object> args = new HashMap<String, Object>();
|
||||
System.setProperty("disableSpringSnapshotRepos", "true");
|
||||
try {
|
||||
new AetherGrapeEngine(this.groovyClassLoader, null, null, null).grab(args,
|
||||
createDependency("org.springframework", "spring-jdbc", "3.2.0.M1"));
|
||||
}
|
||||
finally {
|
||||
System.clearProperty("disableSpringSnapshotRepos");
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> createDependency(String group, String module,
|
||||
String version) {
|
||||
Map<String, Object> dependency = new HashMap<String, Object>();
|
||||
|
|
|
@ -49,7 +49,6 @@ public class SampleIntegrationTests {
|
|||
@BeforeClass
|
||||
public static void cleanGrapes() throws Exception {
|
||||
GrapesCleaner.cleanIfNecessary();
|
||||
// System.setProperty("ivy.message.logger.level", "3");
|
||||
}
|
||||
|
||||
@Rule
|
||||
|
|
Loading…
Reference in New Issue