温馨提示:本文翻译自stackoverflow.com,查看原文请点击:playframework - How to remove all default resolvers from a Play! application?
playframework sbt typesafe-stack maven-central typesafe

playframework - 如何从Play中删除所有默认解析器!

发布于 2020-03-27 11:34:18

背景:我们公司有好几个玩!应用程序,其测试在我们的内部CI中运行。每个Play应用程序都通过http从各种公共存储库中检索依赖关系。这并不理想(它绕过了我们的内部Nexus存储库),但是可以忍受。现在,我们增加了额外的CI容量,并且不想让新计算机能够在防火墙外部访问。

在示例Play应用中,以下配置project/Build.scala不足以阻止构建进入repo.typesafe.comrepo1.maven.org

sbtResolver := "Typesafe (proxy)" at "http://repo-1/nexus/content/repositories/typesafe-releases/"

resolvers := Seq(
  "Maven Central (proxy)" at "http://repo-1/nexus/content/repositories/central/",
  "Typesafe (proxy)" at "http://repo-1/nexus/content/repositories/typesafe-releases/",
  // some more internal Nexus repositories
)

externalResolvers := Seq.empty

repo-1是我们的内部Nexus主机,用于代理Maven Central,Typesafe和其他存储库)

当我从Maven Central(例如Guava)或Typesafe的存储库(例如Play mailer插件)中删除某些依赖项并运行时play compile,我从输出中看到仍从repo.typesafe.com中检索到依赖项repo1.maven.org

[info] downloading http://repo.typesafe.com/typesafe/releases/com/typesafe/play-plugins-mailer_2.9.1/2.0.2/play-plugins-mailer_2.9.1-2.0.2.jar ...
[info]  [SUCCESSFUL ] com.typesafe#play-plugins-mailer_2.9.1;2.0.2!play-plugins-mailer_2.9.1.jar (981ms)
[info] downloading http://repo1.maven.org/maven2/com/google/guava/guava/12.0/guava-12.0.jar ...
[info]  [SUCCESSFUL ] com.google.guava#guava;12.0!guava.jar (1422ms)

为了解决这个问题,我们还使用了所有版本的旧版本:Scala 2.9.1,Play 2.0.1,sbt 0.11.3。


如何强制Play应用专门从内部存储库中检索依赖关系?

查看更多

查看更多

提问者
Grundlefleck
被浏览
26
vizog 2014-05-08 15:11

编辑或创建/home/YOUR_HOME/.sbt/存储库,添加以下内容:

[repositories] local my-maven-proxy-releases: http://nexus_domain_or_ip:8081/nexus/content/groups/public/

运行播放时,请添加以下参数:-Dsbt.override.build.repos = true

例如:激活程序运行-Dsbt.override.build.repos = true

这样可以防止播放加载项目配置中定义的存储库。

请参阅了解详情。