sbt 0.11.2: use only corporate nexus repository for dependencies

戏子无情 提交于 2020-01-14 03:33:07

问题


I am trying to setup an sbt instance installed with the typesafe stack to only use my private nexus repository for all of the dependencies.

But no matter what I try, the dependencies are downloaded from http://repo.typesafe.com/typesafe/releases. I have tried many solutions and especially the ones explained here, here and here.

I have even tried to change the sbt.boot.properties inside the sbt-launch.jar but with no luck. Is there something special in the typesafe stack that prevents from changing the sbt behavior in that respect?

By the way, I want to use the nexus + local for everything, not just project dependencies: dependencies, plugins, everything that sbt needs to download.


回答1:


Check that you have cleared the contents of the following folder ~/.sbt , as it might contain references to a typesafe resolver.

In your Build.scala or any .sbt file (plugins or build) , make sure all your resolvers now point to your nexus repository.

Make sure your sbt launch script looks like this:

java -Dsbt.boot.properties=sbt.boot.properties -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar dirname $0/sbt-launch.jar "$@"

Let me know if this does not work out.

Krishnen




回答2:


Just wanted to say that in sbt 0.12, we specifically tried to address this need/concern. We now have full support of proxy repositories from the launcher -> project.

Basically, in sbt 0.12.3 (Play 2.1) just create a file: ~/.sbt/repositories

[repositories]
  local
  my-ivy-proxy-releases: http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  my-maven-proxy-releases: http://repo.company.com/maven-releases/

Then when starting sbt, us a -Dsbt.override.build.repos=true

You can also specify different proxy files using -Dsbt.repository.config=<path-to-your-repo-file>

Hope this helps! - Josh

Please see: http://www.scala-sbt.org/release/docs/Detailed-Topics/Proxy-Repositories.html for more information.



来源:https://stackoverflow.com/questions/10031382/sbt-0-11-2-use-only-corporate-nexus-repository-for-dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!