(SBT)如何禁用默认解析器,而仅使用公司内部解析器? [英] (SBT) How to disable default resolver and only use the company internal resolver?

查看:77
本文介绍了(SBT)如何禁用默认解析器,而仅使用公司内部解析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要使用公司内部的常春藤/maven存储库(人工工厂)来提高解析速度和下载jar文件的速度,还希望使用它在组织中不同团队之间交换二进制jar文件.

We want to use company internal ivy/maven repository (artifactory) to improve the speed of resolving, and downloading the jar files, and also we want to use it to exchange binary jar files between different teams in our organization.

我知道我们可以通过将~/.repositories设置为

I know we can force SBT to go through proxy by setting ~/.repositories with

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

,然后使用-Dsbt.override.build.repos=true启动SBT.这种方法对我有用.

and then launch SBT with -Dsbt.override.build.repos=true. This method works for me.

但是,要求所有开发人员以这种方式进行设置有点麻烦.我们想知道是否可以在不进行额外配置的情况下完全覆盖Build.scala和plugin.sbt中的默认解析器.

However, it's kind of cumbersome to ask all the developers to setup this way. We're wondering if we can override the default resolvers completely in Build.scala, and plugin.sbt without extra configuration.

到目前为止,我已经尝试了以下方法,但均未成功.

So far, I've tried the following ways without success.

1)在Build.scala和plugin.sbt中,我都添加了

1) In both Build.scala and plugin.sbt, I added

resolvers := "Local Repo" at "http://repo.alpinenow.com/artifactory/repo/",

externalResolvers := Seq(Resolver.url("Local Repo", url("http://repo.alpinenow.com/artifactory/repo"))(Resolver.ivyStylePatterns)),

但是它仍然从typesafe和maven1下载jar.

but it still downloads the jars from typesafe and maven1.

2)然后,我决定将存储库文件放入项目文件夹,并尝试直接在plugin.sbt和Build.scala中添加Java选项

2) I then decided to put repositories file into project folder, and tried to add java option directly inside plugin.sbt, and Build.scala with

System.setProperty("-Dsbt.override.build.repos", "true"),

System.setProperty("-Dsbt.repository.config", "project/repositories"),

,但仍然无法正常工作.我很好奇,当SBT获得解析程序的Java选项时,因为很明显,它早于plugin.sbt和Build.scala.

but it still doesn't work. I'm curious when the SBT gets the java options for resolvers since obviously, it's before plugin.sbt and Build.scala.

有什么主意吗?

谢谢.

蔡德怀

推荐答案

如果您离开 sbt-extras shell脚本替代默认启动器脚本,我想您可以通过设置~/.repositories并添加-Dsbt.override.build.repos=true轻松地对其进行修改.然后,您要做的就是确保开发人员使用该脚本.

If you depart from the sbt-extras shell script as a replacement for the default launcher script, I guess you could easily modify that with setting up ~/.repositories and adding -Dsbt.override.build.repos=true. Then all you need to do is ensure your developers use that script.

这篇关于(SBT)如何禁用默认解析器,而仅使用公司内部解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆