Skip to content

Commit

Permalink
Merge pull request #1 from tlazaro/tlazaro/coursier-maven-url
Browse files Browse the repository at this point in the history
Implements Maven URL when resolving artifacts
  • Loading branch information
ianoc authored Apr 21, 2022
2 parents 38f763f + d01b062 commit 738c74b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/scala/com/github/johnynek/bazel_deps/CoursierResolver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,16 @@ class CoursierResolver(servers: List[DependencyServer], ec: ExecutionContext, ru
.replaceAllLiterally("[ext]", Option(extension).filter(_.nonEmpty).getOrElse("jar"))

Some(s"$url$subUrl")
case MavenServer(_, _, _) => None
case MavenServer(_, _, url) =>
// Builds a Maven artifact URL
def mavenUrl(url: String, organization: String, moduleName: String, version: String, classifier: Option[String], extension: Option[String]): String = {
val classifierSuffix: String = classifier.filter(_.nonEmpty).map("-" + _).getOrElse("")
val ext: String = extension.filter(_.nonEmpty).getOrElse("jar")

s"$url/${organization.replace('.', '/')}/$moduleName/$version/$moduleName-$version$classifierSuffix.$ext"
}

Some(mavenUrl(url, organization, moduleName, version, None, Option(extension)))
}.flatten


Expand Down

0 comments on commit 738c74b

Please sign in to comment.