gpt4 book ai didi

scala - SBT 0.13.1 离线

转载 作者:行者123 更新时间:2023-12-02 01:50:29 26 4
gpt4 key购买 nike

我正在尝试了解 SBT 0.13.1 的离线使用。我的目标是将任何需要的东西都带到 USB 内存棒上的离线环境中。我认为如果复制了 ivy 缓存,那么 SBT 就可以从中提取所需的一切,但事实并非如此。

例如……

为了保险起见,我将从删除 .ivy2 文件夹开始。现在,在线时我使用以下 build.sbtproject/plugins.sbt 文件来创建我的 eclipse 项目。来自 SBT 0.13.1

build.sbt:

name := "TestProject"

version := "0.0.1"

scalaVersion := "2.10.3"

libraryDependencies ++= Seq(
"org.apache.commons" % "commons-math3" % "3.2",
"ch.qos.logback" % "logback-classic" % "1.1.1"
)

项目/plugins.sbt:

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")

在我离线的同一台计算机上,现在 sbt clean eclipse 给出了许多 Unresolved 依赖性错误。例如

[warn] Host repo1.maven.org not found. url=http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.3/scala-library-2.10.3.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: org.scala-lang#scala-library;2.10.3
[warn] ==== local: tried
[warn] /home/user/.ivy2/local/org.scala-lang/scala-library/2.10.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.3/scala-library-2.10.3.pom
[info] Resolving ch.qos.logback#logback-classic;1.1.1 ...
[warn] Host repo1.maven.org not found. url=http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: ch.qos.logback#logback-classic;1.1.1
[warn] ==== local: tried
[warn] /home/user/.ivy2/local/ch.qos.logback/logback-classic/1.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[info] Resolving org.scala-lang#scala-reflect;2.10.3 ...
[warn] Host repo1.maven.org not found. url=http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.3/scala-reflect-2.10.3.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: org.scala-lang#scala-reflect;2.10.3
[warn] ==== local: tried
[warn] /home/user/.ivy2/local/org.scala-lang/scala-reflect/2.10.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.3/scala-reflect-2.10.3.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.3: not found
[warn] :: ch.qos.logback#logback-classic;1.1.1: not found
[warn] :: org.scala-lang#scala-reflect;2.10.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

离线工作真的无法清洁吗?

我注意到 SBT 正在查找 .ivy2/local,但是没有这样的文件夹。只有'.ivy2/cache'。

更新:

添加 .ivy2/local 的建议无效。它给出了许多 MalformedURLException

[warn]  :: org.scala-lang#scala-library;2.10.3: ivy2 cache: unable to get resource for org/scala-lang#scala-library;2.10.3: res=/home/user/.ivy2/cache/org/scala-lang/scala-library/2.10.3/scala-library-2.10.3.pom: java.net.MalformedURLException: no protocol: /home/user/.ivy2/cache/org/scala-lang/scala-library/2.10.3/scala-library-2.10.3.pom

它正在寻找目录 org/scala-lang 等,但是缓存中的目录是 org.scala-lang 的形式

更新 2

问题似乎是与 logback 的一些交互引起的。我已经为我的问题创建了一个更清晰的版本 here ,并接受表明这个“应该”开箱即用的答案。

最佳答案

如果你在线构建项目,那么你可以在之后离线。基本上,您只想将 ~/.ivy2 文件夹(可能还有 ~/.sbt 文件夹 - 不确定)从之前已完成构建和依赖项解析的位置复制到您的环境中。

删除项目中的目标/,然后下线,我可以看到这确实导致资源被解析。

[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 4 Scala sources to [...]

关于scala - SBT 0.13.1 离线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23014492/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com