Getting both Maven and SBT use local Artifactory-server

依然范特西╮ 提交于 2019-11-29 14:19:42

问题


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.

I'm getting grey hair with SBT especially.

SBT Problems connecting to Artifactory

With 0.11.[0..3] I can SBT to access Artifactory via following:

  • Unzip sbt-launcher.jar
  • Get sbt.boot.properties and copy it somewhere
  • Edit sbt.boot.properties to include only 'local' repository and our Artifactory server

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:

  • I've built SBT myself
  • I've put 'repositories' file into ~/.sbt/
  • 'repositories' file includes:

    [repositories]

    local

    ivy-proxy: http://devserver:8081/artifactory/repo/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]

    maven-proxy: http://devserver:8081/artifactory/repo/

  • 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-SNAPSHOT -jar /Users/amjr/.bin/.lib/0.13.0-SNAPSHOT/sbt-launch.jar

But 0.12 and 0.13 refuse to access Artifactory but try to connect directly to typesafe, maven central etc.

Artifactory and problems when SBT does access it

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

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.


回答1:


I have the following scala-friendly repositories set up for our work environment:

  • Scala Tools: https://oss.sonatype.org/content/groups/scala-tools/
  • TypeSafe: http://repo.typesafe.com/typesafe/releases/
  • JFrog: http://repo.jfrog.org/artifactory/libs-releases-local

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/



来源:https://stackoverflow.com/questions/11583665/getting-both-maven-and-sbt-use-local-artifactory-server

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