You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SBT忽略Ivy插件仓库代理配置问题求助

Fixing SBT Plugin Resolution via Nexus Ivy Proxy

Let's break down why your sbt-assembly is still pulling from the official repo instead of your Nexus ivy-public, and walk through the fixes step by step:

1. First: Verify Your Nexus Ivy Repository Setup

The root issue here is that sbt-assembly lives in the dedicated SBT plugin repository, so your Nexus ivy-public repo needs to proxy this source to serve the plugin.

  • Log into your Nexus 3.7.1 instance
  • Navigate to your ivy-public repository's configuration page
  • Add a proxy source pointing to https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/
  • Save the config and trigger a repository index refresh (this ensures Nexus can find and cache the plugin artifacts)

2. Update Your Global SBT Repository Config

Your current ~/.sbt/repositories config covers regular Maven/Ivy artifacts, but SBT uses separate repositories for plugins. You need to explicitly override these to point to your Nexus proxy:

Replace your existing config with this:

[repositories]
local
mvn-repositories: https://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8443/repository/maven-public/
ivy-proxy-releases: https://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8443/repository/ivy-public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
# Override default SBT plugin repositories
sbt-plugin-releases: https://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8443/repository/ivy-public/, [organization]/[module]/scala_[scalaVersion]/sbt_[sbtVersion]/[revision]/[type]s/[artifact](-[classifier]).[ext]
sbt-plugin-snapshots: https://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8443/repository/ivy-public/, [organization]/[module]/scala_[scalaVersion]/sbt_[sbtVersion]/[revision]/[type]s/[artifact](-[classifier]).[ext]

This ensures both regular artifacts and SBT plugins are resolved through your Nexus instance.

3. Force SBT to Use Your Global Config

By default, SBT might prioritize project-level repository settings over your global config. To override this:

  • Add the following line to ~/.sbtopts (create the file if it doesn't exist):
    -Dsbt.override.build.repos=true
    
  • Alternatively, start SBT with this flag explicitly:
    sbt -Dsbt.override.build.repos=true
    

4. Test the Fix

To confirm the change works, clear your local cache for sbt-assembly first (so SBT has to re-pull it):

rm -rf ~/.ivy2/cache/com.eed3si9n

Then start SBT. You should see log output like this, showing sbt-assembly pulling from your Nexus repo:

[info] downloading https://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8443/repository/ivy-public/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.6/jars/sbt-assembly.jar ...

Bonus: Check for Authentication Issues

If you still see problems, verify that your Nexus ivy-public repo allows unauthenticated access (or that you've added credentials to your SBT config). You can add credentials in ~/.ivy2/credentials with:

realm=Nexus Repository Manager
host=ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com
user=your-nexus-username
password=your-nexus-password

And reference it in ~/.sbt/repositories by adding credentials ${file("~/.ivy2/credentials")} under the [repositories] section.


内容的提问来源于stack exchange,提问作者Y. Eliash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:04:01