使用org.apache.hadoop/*依赖项离线编译sbt的麻烦 [英] Troubles with sbt compiling offline using org.apache.hadoop/* dependencies

查看:125
本文介绍了使用org.apache.hadoop/*依赖项离线编译sbt的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用依赖于org.apache.hadoop软件包的sbt进行脱机编译时遇到了很多麻烦.

got a lot of troubles compiling offline with sbt having dependencies on org.apache.hadoop packages.

一个简单的build.sbt:

A simple build.sbt:

name := "Test"

version := "1.0"

scalaVersion := "2.10.4"

libraryDependencies += "org.apache.hadoop" % "hadoop-yarn-api" % "2.2.0"

联机时工作正常,但在常春藤缓存中(位于〜/ivy2/cache/org.apache.hadoop/...下)时,程序包存在于常春藤中时,会出现以下错误:

works fine while online but gives following error when running offline, while the package is present in the ivy cache (under ~/ivy2/cache/org.apache.hadoop/...):

[info] Loading project definition from /home/martin/Dev/S/project
[info] Set current project to Test (in build file:/home/martin/Dev/S/)
[info] Updating {file:/home/martin/Dev/S/}s...
[info] Resolving org.apache.hadoop#hadoop-yarn-api;2.2.0 ...
[warn] Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-yarn-api/2.2.0/hadoop-yarn-api-2.2.0.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn]  module not found: org.apache.hadoop#hadoop-yarn-api;2.2.0
[warn] ==== local: tried
[warn]   /home/martin/.ivy2/local/org.apache.hadoop/hadoop-yarn-api/2.2.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-yarn-api/2.2.0/hadoop-yarn-api-2.2.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.apache.hadoop#hadoop-yarn-api;2.2.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      org.apache.hadoop:hadoop-yarn-api:2.2.0 (/home/martin/Dev/S/build.sbt#L15-16)
[warn]        +- test:test_2.10:1.0
sbt.ResolveException: unresolved dependency: org.apache.hadoop#hadoop-yarn-api;2.2.0: not found
    ...
[error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.hadoop#hadoop-yarn-api;2.2.0: not found
[error] Total time: 3 s, completed Apr 26, 2015 2:46:58 PM

添加以下解析器无济于事:

Adding the following resolver didn't help:

resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/cache")) (Resolver.ivyStylePatterns)

它只是添加

[warn] ==== Local repo: tried
[warn]   /home/martin/.ivy2/cache/org.apache.hadoop/hadoop-yarn-api/2.2.0/ivys/ivy.xml

这些文件存在,但名为ivy-2.2.0.xml,而不是2.2.0/ivys/ivy.xml

The files are present but named ivy-2.2.0.xml, not 2.2.0/ivys/ivy.xml

所以我尝试添加

resolvers += Resolver.file("Local repo 2", file(System.getProperty("user.home") + "/.ivy2/cache")) ( Patterns("[organisation]/[module]/[artifact]-[revision].[ext]") )

强制使用命名约定,但随后看起来会

To force the naming convention but it then looks under

[warn] ==== Local repo 2: tried
[warn]   /home/martin/.ivy2/cache/org/apache/hadoop/hadoop-yarn-api/ivy-2.2.0.xml

即使根据sbt doc,[organization]应该是org.apache.hadoop而不是org/apache/hadoop

even when according to the sbt doc [organisation] should be org.apache.hadoop and not org/apache/hadoop

所以最后我还是加了一个丑陋的

So finally as a last resort i added an ugly

resolvers += Resolver.file("Local hadoop cache", file(System.getProperty("user.home") + "/.ivy2/cache")) ( Patterns("org.apache.hadoop/[module]/[artifact]-[revision].[ext]") )

在那里找到了一些东西,但仍然不满意:

and there it found something, but still was not happy with it:

[info] Loading project definition from /home/martin/Dev/S/project
[info] Set current project to Test (in build file:/home/martin/Dev/S/)
[info] Updating {file:/home/martin/Dev/S/}s...
[info] Resolving org.apache.hadoop#hadoop-yarn-api;2.2.0 ...
[warn] Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-yarn-api/2.2.0/hadoop-yarn-api-2.2.0.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] xml parsing: ivy-2.2.0.xml.original:18:69: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:19:11: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:20:17: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:21:14: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:22:14: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:24:17: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
[warn] xml parsing: ivy-2.2.0.xml.original:25:12: schema_reference.4: Failed to read schema document 'http://maven.apache.org/xsd/maven-4.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
...

我不知道下一步该怎么做.如果我将.ivy2/cache/目录复制到脱机计算机,则对于我尝试过的任何其他依赖项,脱机构建都可以正常工作.仅仅是一堆org.apache.hadoop依赖项导致了此问题. .ivy2/cache/org.apache.hadoop下的结构和文件看起来与其他运行良好的依赖项中的文件相同.

I'm out of clues about what to to try next. Building offline works fine for any other dependency i tried if i copy the .ivy2/cache/ directories to the offline machine. It's just a bunch of org.apache.hadoop dependencies that cause this problem. The structure and the files under .ivy2/cache/org.apache.hadoop look the same as the ones from the other dependencies that work well.

添加

offline := true

也没有帮助.

使用sbt 0.13.7

Using sbt 0.13.7

谢谢!

推荐答案

似乎是sbt错误.我在使用 sbt 0.13.8 时遇到了同样的问题,但是他们改用 0.13.9-RC3 并清理了~/.ivy2

Seemed to be an sbt bug. I had same problems with sbt 0.13.8 but they gone away with switching to 0.13.9-RC3 and cleaning ~/.ivy2

这篇关于使用org.apache.hadoop/*依赖项离线编译sbt的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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