如何让sbt从我的本地存储库中使用我的jar?

时间:2017-04-06 09:20:32

标签: linux centos sbt

我正在尝试以非常严格的安全性在我的Linux VM(CentOS)中安装SBT。

无法访问

我已经解压缩了SBT zip文件,并将bin路径添加到环境变量中。

正如所料,我无法运行SBT。

[admin@xxx]$ sbt
Getting org.scala-sbt sbt 0.13.12 ...

:: problems summary ::
:::: WARNINGS
            module not found: org.scala-sbt#sbt;0.13.12

    ==== local: tried

      /home/admin/.ivy2/local/org.scala-sbt/sbt/0.13.12/ivys/ivy.xml

      -- artifact org.scala-sbt#sbt;0.13.12!sbt.jar:

      /home/admin/.ivy2/local/org.scala-sbt/sbt/0.13.12/jars/sbt.jar

    ==== Maven Central: tried

      https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.12/sbt-0.13.12.pom

      -- artifact org.scala-sbt#sbt;0.13.12!sbt.jar:

      https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.12/sbt-0.13.12.jar

    ==== typesafe-ivy-releases: tried

      https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.12/ivys/ivy.xml

    ==== sbt-ivy-snapshots: tried

      https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/0.13.12/ivys/ivy.xml

            ::::::::::::::::::::::::::::::::::::::::::::::

            ::          UNRESOLVED DEPENDENCIES         ::

            ::::::::::::::::::::::::::::::::::::::::::::::

            :: org.scala-sbt#sbt;0.13.12: not found

            ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
    Server access Error: Connection timed out url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.12/sbt-0.13.12.pom

    Server access Error: Connection timed out url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.12/sbt-0.13.12.jar

    Server access Error: Connection timed out url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.12/ivys/ivy.xml

    Server access Error: Connection timed out url=https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/0.13.12/ivys/ivy.xml


:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.12: not found
Error during sbt execution: Error retrieving required libraries
(see /home/admin/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.12

我设法通过添加存储库文件

使其使用我的存储库

存储库

[repositories]
  local
  my-maven-proxy-releases: http://nexuspro.company.com/nexus/service/local/repositories/

然后我用这个参数运行SBT命令:

sbt -Dsbt.repository.config=/sbt/conf/repositories

现在我的问题是SBT似乎使用的默认目录结构与我的存储库不同。

<my repository>/org/scala-sbt/sbt/0.13.12/sbt-0.13.12.jar

所以我现在的问题是如何设置SBT才能使用我的jar?也许强迫它使用我的罐子的绝对路径

<my repository>/sbt-0.13.12.jar

2 个答案:

答案 0 :(得分:2)

This will be useful for you guys who have no internet connection but needs to use sbt.

This is based on thirstycrow's third option.

First you need to update your sbt in an environment with access to internet.

sbt update

If you need a certain version of sbt you need to edit your build.properties before calling sbt update

Then you copy your .ivy2\cache to to the target environment(no internet)

Then set your cache as your repository

repositories

[repositories]
local
cache: file://home/admin/.ivy2/cache, [organisation]/[module]/[type]s/[module]-[revision].[type], [organisation]/[module]/ivy-[revision].xml

Then call sbt with parameter pointing to your repository file

sbt -Dsbt.repository.config=/sbt/conf/repositories

答案 1 :(得分:0)

这样做的一种正确方法是将这两个存储库代理到您公司的私有存储库。我想知道最新版本的nexus是否增加了对代理/服务常春藤存储库的支持。如果没有,你将不得不切换到神器。

另一种方法是使用本地安装的工件代理所需的存储库,并通过ssh隧道将其提供给您的虚拟机。当我没有权限管理公司存储库时,我就玩了这个技巧。

如果上述想法不适合你。最后一次机会是在可以访问所需存储库的某个地方构建项目。然后将〜/ .ivy目录复制到您的虚拟机。这就是常春藤存储所获取的文物的地方。

相关问题