1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Resolve snapshot repos correctly.

Fixes https://github.com/cbeust/kobalt/issues/377.
This commit is contained in:
Cedric Beust 2017-04-01 13:42:09 -07:00
parent 53924366ba
commit b011abc13b
2 changed files with 27 additions and 8 deletions

View file

@ -16,6 +16,7 @@ import org.eclipse.aether.graph.Dependency
import org.eclipse.aether.repository.RemoteRepository
import org.eclipse.aether.resolution.ArtifactResult
import org.eclipse.aether.resolution.DependencyRequest
import org.eclipse.aether.resolution.DependencyResolutionException
import org.testng.annotations.DataProvider
import org.testng.annotations.Guice
import org.testng.annotations.Test
@ -68,6 +69,21 @@ class MavenResolverTest {
assertThat(closure.none { it.toString().contains("android") })
}
@Test
fun shouldResolveSnapshots() {
try {
// Should throw
resolver.resolve("org.bukkit:bukkit:1.11.2-R0.1-SNAPSHOT")
} catch(ex: DependencyResolutionException) {
// Success. Note: run the failing test first, because once the resolve succeeds, its
// results are cached in the local repo.
}
// Should succeed
resolver.resolve("org.bukkit:bukkit:1.11.2-R0.1-SNAPSHOT",
repos = listOf("https://hub.spigotmc.org/nexus/content/repositories/snapshots"))
}
private fun resolve(id: String): List<ArtifactResult> {
val system = Booter.newRepositorySystem()
val session = Booter.newRepositorySystemSession(system,