让 Maven 和 SBT 都使用本地 Artifactory-server [英] Getting both Maven and SBT use local Artifactory-server
问题描述
我需要同时使用 Maven 和 SBT 才能使用本地 Artifactory-server,它是唯一具有 Internet 连接的机器.服务器、CI 机器等无法访问外部世界.
I need to get both Maven and SBT to use local Artifactory-server which is only machine that has Internet connection. Servers, CI-machine, etc don't have access to outside world.
尤其是 SBT,我的头发都变白了.
I'm getting grey hair with SBT especially.
使用 0.11.[0..3] 我可以通过以下方式 SBT 访问 Artifactory:
With 0.11.[0..3] I can SBT to access Artifactory via following:
- 解压 sbt-launcher.jar
- 获取 sbt.boot.properties 并将其复制到某处
- 编辑 sbt.boot.properties 以仅包含本地"存储库和我们的 Artifactory 服务器
对于 0.12 或 0.13 版本,我没有运气.我试过这里的说明:https://github.com/harrah/xsbt/pull/472.所以我做了以下:
With 0.12 or 0.13 versions I have no luck. I've tried with instructions found here: https://github.com/harrah/xsbt/pull/472. So I have done following:
- 我自己构建了 SBT
- 我已将存储库"文件放入 ~/.sbt/
'repositories' 文件包括:
- I've built SBT myself
- I've put 'repositories' file into ~/.sbt/
'repositories' file includes:
[仓库]
本地
ivy-proxy: http://devserver:8081/artifactory/repo/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
maven-proxy: http://devserver:8081/artifactory/repo/
我在 SBT 的启动命令中包含了-Dsbt.override.build.repos=true",现在看起来像这样:
I've included '-Dsbt.override.build.repos=true' in SBT's launch command which looks like this now:
java -Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m -Dsbt.override.build.repos=true -Dsbt.global.base=/Users/amjr/.sbt/0.13.0-快照-jar/Users/amjr/.bin/.lib/0.13.0-SNAPSHOT/sbt-launch.jar
但是 0.12 和 0.13 拒绝访问 Artifactory 而是尝试直接连接到 typesafe、maven central 等
But 0.12 and 0.13 refuse to access Artifactory but try to connect directly to typesafe, maven central etc.
现在对于 0.11 系列的 SBT,我可以让它连接到 Artifactory.然后是SBT无法找到编译项目所需的包的问题.示例如下:
Now for 0.11-series of SBT I can get it to connect to Artifactory. Then there is problem that SBT is unable to find packages it needs for compiling the project. Here is example:
==== local-artifactory-libs-snapshot: tried
http://devserver:8081/artifactory/libs-snapshot/org/scala-sbt/compiler-interface/0.11.3/compiler-interface-src-0.11.3.jar
==== local-artifactory-libs-releases: tried
http://devserver:8081/artifactory/libs-release/org/scala-sbt/compiler-interface/0.11.3/compiler-interface-src-0.11.3.jar
==== local-artifactory-plugins-releases: tried
http://devserver:8081/artifactory/plugins-release/org/scala-sbt/compiler-interface/0.11.3/compiler-interface-src-0.11.3.jar
这显然与 Artifactory 配置有关.如果有人有任何指示,我应该如何使用 Artifactory 代理以及代理哪些存储库,以便成功地将它与 SBT 一起使用,我将不胜感激.
This must obviously be something related to Artifactory configuration. I would appreciate if someone has any pointers how and what repositories I should proxy with Artifactory in order to succesfully use it with SBT.
推荐答案
我为我们的工作环境设置了以下对 Scala 友好的存储库:
I have the following scala-friendly repositories set up for our work environment:
- Scala 工具:https://oss.sonatype.org/content/groups/Scala工具/
- TypeSafe:http://repo.typesafe.com/typesafe/releases/
- JFrog:http://repo.jfrog.org/artifactory/libs-releases-本地
你上面提到的编译器接口在Typesafe仓库中,具体
The compiler interface you mentioned above is in the Typesafe repository, specifically
http:///repo.typesafe.com/typesafe/maven-ivy-releases/org.scala-sbt/compiler-interface/0.11.3/
这篇关于让 Maven 和 SBT 都使用本地 Artifactory-server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!