SBT 0.13.1离线 [英] SBT 0.13.1 offline

查看:64
本文介绍了SBT 0.13.1离线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图离线了解SBT 0.13.1的用法.我的目标是通过USB随身碟将所需的一切带到离线环境中.我以为,如果复制了常春藤缓存,那么SBT可以从中提取所需的一切,但事实并非如此.

I'm trying to understand the use of SBT 0.13.1 offline. My goal is to bring whatever is necesary to an offline environment on a USB stick. I thought that if the ivy cache was copied then SBT could pull everything it needs out of it, but that doesn't seem to be the case.

例如...

为确定起见,我将首先删除.ivy2文件夹.现在,在联机时,我使用以下build.sbtproject/plugins.sbt文件创建我的eclipse项目.来自SBT 0.13.1

I'll start by deleting the .ivy2 folder, just to be sure. Now, while online I use the following build.sbt and project/plugins.sbt files to create my eclipse project. from 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"
)

project/plugins.sbt:

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

在同一台计算机上,我下线了,现在sbt clean eclipse给出了许多未解决的依赖项错误.例如

Sill on the same computiner I go offline, and now sbt clean eclipse gives lots of unresolved dependency errors. E.g.

[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]  ::::::::::::::::::::::::::::::::::::::::::::::

脱机工作时真的不可能清理吗?

Is it really impossible to clean when working offline?

我注意到SBT正在.ivy2/local中查找,但是没有这样的文件夹.只有".ivy2/缓存".

I notice that SBT is looking in .ivy2/local, but there is no such folder. Only '.ivy2/cache'.

更新:

添加.ivy2/local的建议无效.它提供了许多MalformedURLException

Suggestion to add .ivy2/local didn't work. It gives many 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等,但是缓存中的thr目录的格式为org.scala-lang

It's looking for a directory org/scala-lang etc, but thr directories in cache are of the form org.scala-lang

更新2

该问题似乎是由与Logback的某些交互作用引起的.我在此处中创建了更清晰的问题版本,并接受表示该应该"用完了的答案.

It seems that the problem is caused with some interaction with logback. I've created a clearer version of my question here, and am accepting the answer that indicated that this 'should' run out of the box.

推荐答案

如果在线构建项目,则之后可以脱机. 基本上,您只想将〜/.ivy2文件夹(可能不确定的〜/.sbt文件夹-不确定)从之前已经完成构建和依赖关系解析的位置复制到您的环境中.

If you build the project online, then you can go offline after. Basically, you'd just want to copy the ~/.ivy2 folder (and possibly ~/.sbt folder - unsure) into your environment from a location that has done the building and dependency resolution before.

在项目中删除目标/,然后脱机,我可以看到这确实导致资源被解析.

Removing target/ in a project, then going offline, I can see that this does cause the resources to be resolved.

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

这篇关于SBT 0.13.1离线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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