From 729c62278a17619eb3c3e9a81e425aace5bf598c Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Thu, 23 Mar 2017 14:07:48 +0100 Subject: [PATCH] Fix missing artifacts for snapshot versioning Regression since recent overhaul of artifact type handling --- .../coursier/maven/MavenRepository.scala | 8 +----- .../scala/coursier/test/CentralTests.scala | 25 ++++++++++++++----- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/core/shared/src/main/scala/coursier/maven/MavenRepository.scala b/core/shared/src/main/scala/coursier/maven/MavenRepository.scala index 3bacc9939..9150901b0 100644 --- a/core/shared/src/main/scala/coursier/maven/MavenRepository.scala +++ b/core/shared/src/main/scala/coursier/maven/MavenRepository.scala @@ -292,13 +292,7 @@ final case class MavenRepository( val files = WebPage.listFiles(listFilesUrl, rawListFilesPage) - val versioning = proj0 - .snapshotVersioning - .flatMap(versioning => - mavenVersioning(versioning, "", "") - ) - - val prefix = s"${module.name}-${versioning.getOrElse(version)}" + val prefix = s"${module.name}-${versioningValue.getOrElse(version)}" val packagingTpeMap = proj0.packagingOpt .map { packaging => diff --git a/tests/shared/src/test/scala/coursier/test/CentralTests.scala b/tests/shared/src/test/scala/coursier/test/CentralTests.scala index 49f51f127..6abb0088c 100644 --- a/tests/shared/src/test/scala/coursier/test/CentralTests.scala +++ b/tests/shared/src/test/scala/coursier/test/CentralTests.scala @@ -152,9 +152,10 @@ object CentralTests extends TestSuite { version: String, artifactType: String, extension: String, - attributes: Attributes = Attributes() + attributes: Attributes = Attributes(), + extraRepo: Option[Repository] = None ): Future[Unit] = - withArtifact(module, version, artifactType, attributes = attributes) { artifact => + withArtifact(module, version, artifactType, attributes = attributes, extraRepo = extraRepo) { artifact => assert(artifact.url.endsWith("." + extension)) } @@ -228,11 +229,23 @@ object CentralTests extends TestSuite { 'snapshotMetadata - { // Let's hope this one won't change too much - resolutionCheck( - Module("com.github.fommil", "java-logging"), - "1.2-SNAPSHOT", + val mod = Module("com.github.fommil", "java-logging") + val version = "1.2-SNAPSHOT" + val extraRepo = MavenRepository("https://oss.sonatype.org/content/repositories/public/") + + * - resolutionCheck( + mod, + version, configuration = "runtime", - extraRepo = Some(MavenRepository("https://oss.sonatype.org/content/repositories/public/")) + extraRepo = Some(extraRepo) + ) + + * - ensureHasArtifactWithExtension( + mod, + version, + "jar", + "jar", + extraRepo = Some(extraRepo) ) }