diff --git a/core/shared/src/main/scala/coursier/core/Resolution.scala b/core/shared/src/main/scala/coursier/core/Resolution.scala index f3d7e4d20..171baee4f 100644 --- a/core/shared/src/main/scala/coursier/core/Resolution.scala +++ b/core/shared/src/main/scala/coursier/core/Resolution.scala @@ -885,7 +885,10 @@ final case class Resolution( .getOrElse(Map.empty) ) - private def artifacts0(overrideClassifiers: Option[Seq[String]]): Seq[Artifact] = { + private def artifacts0( + overrideClassifiers: Option[Seq[String]], + keepAttributes: Boolean + ): Seq[Artifact] = { val res = for { dep <- minDependencies.toSeq (source, proj) <- projectCache @@ -893,16 +896,19 @@ final case class Resolution( .toSeq artifact <- source .artifacts(dep, proj, overrideClassifiers) - } yield artifact + } yield (if (keepAttributes) artifact else artifact.copy(attributes = Attributes("", ""))) res.distinct } + // temporary hack :-| + // if one wants the attributes field of artifacts not to be cleared, call dependencyArtifacts + def classifiersArtifacts(classifiers: Seq[String]): Seq[Artifact] = - artifacts0(Some(classifiers)) + artifacts0(Some(classifiers), keepAttributes = false) def artifacts: Seq[Artifact] = - artifacts0(None) + artifacts0(None, keepAttributes = false) private def dependencyArtifacts0(overrideClassifiers: Option[Seq[String]]): Seq[(Dependency, Artifact)] = for { diff --git a/plugin/src/main/scala-2.10/coursier/Tasks.scala b/plugin/src/main/scala-2.10/coursier/Tasks.scala index 6e4fcd47f..ed8aba015 100644 --- a/plugin/src/main/scala-2.10/coursier/Tasks.scala +++ b/plugin/src/main/scala-2.10/coursier/Tasks.scala @@ -581,9 +581,11 @@ object Tasks { }.toSet def artifactFileOpt(artifact: Artifact) = { - val res = artifactFiles.get(artifact) + val artifact0 = artifact + .copy(attributes = Attributes()) // temporary hack :-( + val res = artifactFiles.get(artifact0) - if (res.isEmpty && !erroredArtifacts(artifact)) + if (res.isEmpty && !erroredArtifacts(artifact0)) log.error(s"${artifact.url} not downloaded (should not happen)") res