2012-09-20 31 views
42

在shell中,我在Impatient/part1目录中输入了gradle cleanJar。输出如下。错误是“org.apache.hadoop.mapred.JobConf的类文件未找到”。为什么它不能编译?使用Java 6级联示例未能编译?

: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 
+12

我不认为这应该被关闭是Gradle不能很好地与Java 7一起玩,任何人通过7.x JDK的级联教程都会遇到这个问题。我很高兴地补充说,答案是使用带有级联教程的Java 6 JDK。 –

+0

另请参阅https://groups.google.com/d/topic/cascading-user/XEZapg4uqdI/discussion – hertzsprung

+0

我相信这是因为您没有安装hadoop,并且wordcount/build.gradle具有“{transitive = false }“所以它不会安装它。删除它,它会建立。 –

回答

1

尝试,gradle这个有一些已知问题与Java 7

0

好像没有发现类,请在构建路径条目库。

1

将hadoop-core-1.x.y.jar从hadoop分发添加到路径。

这对CoPA例子中的我很有用。我添加到eclipse构建路径。

添加这摇篮依赖{}部分

编译(组: 'org.apache.hadoop',名称: 'Hadoop的核心',版本: '1.2.0')

0

我今天尝试使用Cascading for the Impatient教程的相同问题。我已经解决了将在dependencies部分下面我build.gradle

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的here全部回购。

0

感谢拉利特, 添加下面的线为我做的伎俩而无需更改任何Java版本..

编译(组:“org.apache.hadoop”,名称:“Hadoop的核心”,版本:这里的问题:“1.2.0”)

另外,我甚至可以添加Hadoop的核心的jar在类路径和提的是,在gradle这个路径