Scala Coursier 自定义 Ivy 存储库

RB_*_*RB_ 5 scala ivy coursier

我想尝试一下 cooursier 工件获取器,但我们正在使用 Artifactory 作为 Maven 和 ivy 存储库,我不知道如何在 coursier 中设置它。他们在文档中提供了这个 ENV 示例。多变的:

export COURSIER_REPOSITORIES="ivy2Local|central|sonatype:releases|jitpack|https://corporate.com/repo"
Run Code Online (Sandbox Code Playgroud)

如果我有带有以下 URL 的artifactory ivy 存储库:http://myivyrepo.tld/joint-ivy-releases它也有一些自定义模式:

[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]
Run Code Online (Sandbox Code Playgroud)

我如何使用 Coursier 进行设置?

ex0*_*0ns 0

为了完成这项工作,我付出了太多的努力,我知道这个问题已经有两年了,但我认为我们可以从它的回答中受益。

据《快递》报道cs fetch --help

  --repository | -r  <maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|typesafe:$repo|sbt-plugin:$repo|scala-integration|scala-nightlies|ivy:$pattern|jitpack|clojars|jcenter|apache:$repo>
        Repository - for multiple repositories, separate with comma and/or add this option multiple times (e.g. -r central,ivy2local -r sonatype:snapshots, or equivalently -r central,ivy2local,sonatype:snapshots)
Run Code Online (Sandbox Code Playgroud)

(也许提出这个问题时情况并非如此)可以在 ivy 存储库前加上 ivy 前缀。此帮助中真正不清楚的是如何提供自定义服务器和模式,但实际上非常简单,您必须在参数中连接两者:

cs fetch --no-default --repository http://myivyrepo.tld/joint-ivy-releases/[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]
Run Code Online (Sandbox Code Playgroud)

Coursier 的内部解析器将负责检测哪一部分是 url,哪一部分是模式。

如果有人对此感兴趣,所有负责的代码都位于IvyRepository.parsecoursier 的函数中。

此外,可以metadataPattern通过用|after 分隔它们来给 ivy 提供快递(我不知道那是什么),就像这样

cs fetch --no-default --repository http://myivyrepo.tld/joint-ivy-releases/[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]|<YOUR_METADATA_OPTS>
Run Code Online (Sandbox Code Playgroud)