42

cleanJar在 shell 中,我在 Impatient/part1 目录中输入了 gradle 。输出如下。错误是“找不到 org.apache.hadoop.mapred.JobConf 的类文件”。为什么编译失败?

:clean UP-TO-DATE
:compileJava
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.pom
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.pom
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-parent/1.6.1/slf4j-parent-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.pom
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.pom
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.pom
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.jar
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.jar
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.jar
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.jar
/home/is_admin/lab/cascading/Impatient/part1/src/main/java/impatient/Main.java:50: error: cannot access JobConf
    Tap inTap = new Hfs( new TextDelimited( true, "\t" ), inPath );
                ^
  class file for org.apache.hadoop.mapred.JobConf not found
1 error
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 22.599 secs
4

5 回答 5

1

尝试使用 Java 6,gradle 有一些 Java 7 的已知问题

于 2013-10-04T15:10:30.957 回答
1

将 hadoop-core-1.xyjar 从 hadoop 分发添加到路径。

这在 CoPA 示例中对我有用。我添加到 Eclipse 构建路径。

将此添加到 gradle 依赖项{} 部分

编译(组:'org.apache.hadoop',名称:'hadoop-core',版本:'1.2.0')

于 2013-10-13T09:34:10.537 回答
0

今天我在尝试不耐烦教程的级联时遇到了同样的问题。我已经解决了将以下内容添加到我build.gradledependencies部分:

compile 'org.apache.hadoop:hadoop-client:2.3.0'

我想使用 Hadoop 2.3.0,但我想您可以选择自己的 Hadoop 版本。

PS:为了使用第一个hadoop-mapred包,您必须添加以下内容:

compile 'org.apache.hadoop:hadoop-mapred:0.22.0'

您可以在此处找到 Hadoop 可能需要的所有存储库。

于 2014-06-20T14:18:56.173 回答
0

似乎找不到类,请检查构建路径条目中的库。

于 2013-10-05T09:49:16.923 回答
0

谢谢拉利特,添加以下行对我来说是诀窍,而无需更改任何 java 版本..

compile( group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.0' )

或者,我什至可以在类路径中添加 hadoop-core jar,并在 gradle 路径中提及

于 2015-08-09T07:04:09.910 回答