Hadoop2.2.0在Ubuntu编译失败解决方法
[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:29.469s [INFO] Finished at: Mon Nov 18 12:30:36 PST 2013 [INFO] Final Memory: 37M/120M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-auth: Compilation failure: Compilation failure: [ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[84,13] cannot access org.mortbay.component.AbstractLifeCycle [ERROR] class file for org.mortbay.component.AbstractLifeCycle not found [ERROR] server = new Server(0); [ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[94,29] cannot access org.mortbay.component.LifeCycle [ERROR] class file for org.mortbay.component.LifeCycle not found [ERROR] server.getConnectors()[0].setHost(host); [ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[96,10] cannot find symbol [ERROR] symbol : method start() [ERROR] location: class org.mortbay.jetty.Server [ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[102,12] cannot find symbol [ERROR] symbol : method stop() [ERROR] location: class org.mortbay.jetty.Server [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :hadoop-auth
这里是Hadoop官网给出的该错误信息,即hadoop-auth没法编译通过,这里是直接把它们给出的错误信息粘贴过来了,如果你也遇到这个错误的话,可以找到hadoop目录下的hadoop-common-project/hadoop-auth文件夹下,可以看到在这下面有一个.pom文件,因为hadoop是用maven进行构建的,而pom文件是maven构建的必要文件,pom对于maven就相当于make对于Makefile,但是又不是完全相同的,因为pom文件中会给出项目构建所依赖的jar包,由maven自动进行依赖包的下载,从而实现对项目的构建。
这里的修改方法是在这个pom文件中的第58行加入
<artifactId>jetty-util</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty</artifactId>
当然可能因为下载的hadoop版本不同在所在行数上有所不同,具体的可以参见,https://issues.apache.org/jira/secure/attachment/12614482/HADOOP-10110.patch 这时hadoop官方提供的一个补丁,加入这些依赖之后,再进行构建,这里就没有问题了