使用 Nexus 代理的 Scala sbt scoverage 插件解析

Scala sbt scoverage plugin resolution with Nexus proxy

我正在我的项目中使用 scoverage 插件 project/plugins.sbt:

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

当我不使用我们公司的 nexus 时,这解决得很好。

为了测试我们的 Nexus 代理,我在下面添加了 ~./sbt/repositories:

[repositories]
    local
    maven-releases: https://repo.example.net/nexus/repository/proxy-central.maven.org/
    ivy-releases: https://repo.example.net/nexus/repository/proxy-repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
    sbt-plugin-releases: https://repo.example.net/nexus/repository/proxy-repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

我删除了 ~./ivy2/cache,当我尝试编译时:

[warn] ==== maven-releases: tried
[warn]   https://repo.jamba.net/nexus/repository/proxy-central.maven.org/org/scoverage/sbt-scoverage_2.12_1.0/1.5.1/sbt-scoverage-1.5.1.pom
[warn] ==== ivy-releases: tried
[warn]   https://repo.jamba.net/nexus/repository/proxy-repo.typesafe.com/typesafe/ivy-releases/org.scoverage/sbt-scoverage/scala_2.12/sbt_1.0/1.5.1/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.jamba.net/nexus/repository/proxy-repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scoverage/sbt-scoverage/scala_2.12/sbt_1.0/1.5.1/ivys/ivy.xml

    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  ::          UNRESOLVED DEPENDENCIES         ::
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  :: org.scoverage#sbt-scoverage;1.5.1: not found
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn] 
    [warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
    [warn]      org.scoverage:sbt-scoverage:1.5.1 (scalaVersion=2.12, sbtVersion=1.0)

我注意到 sbt 覆盖有一个目录结构,其中包括 scala 和 sbt 版本:https://repo1.maven.org/maven2/org/scoverage/sbt-scoverage_2.12_1.0/1.5.1/sbt-scoverage-1.5.1.pom

我也试过改project/plugins.sbt没用:

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1", scalaVersion="2.12", sbtVersion="1.0")

为什么我的 maven 代理没有从 maven central 下载这个插件(尽管它显然存在)是什么原因

注意:代理解析适用于 ivy 风格版本和其他 maven 版本。

编辑: 注意 I:在不使用代理(直接来自 Maven Central)的情况下解析工件非常有效。这就是我得出的结论,代理配置中一定缺少某些东西。 Any/all 指点会有所帮助。 注二:其他工件的解析(包括 sbt-assembly 插件、sbt 本身、scala-reflect 等与我的代理完美配合)

将 Nexus 代理布局设置为宽松