1

当我尝试使用以下方法构建 hadoop 时:

mvn install -e -DskipTests

它总是抛出以下错误:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Hadoop MR1 ................................. FAILURE [3.144s]
[INFO] Apache Hadoop MR1 Examples ........................ SKIPPED
[INFO] Apache Hadoop MR1 Project ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.353s
[INFO] Finished at: Thu Jul 18 11:01:30 PDT 2013
[INFO] Final Memory: 32M/100M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-mr1: Compilation failure
[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[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

我尝试过清理并重新安装不同版本的 Maven,但没有成功。有哪位高手知道这是怎么回事吗?

4

2 回答 2

2

我在 hadoop 2.2.0 源代码构建过程中遇到了同样的问题。在“mvn install -DskipTests”期间,此错误出现在“Hadoop Auth”文件夹中。从某个地方(我不记得从哪里)我知道这个 Hadoop Auth 文件夹的 pom.xml 中缺少一个依赖项

依赖是

<dependency>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-util</artifactId>
  <scope>test</scope>
</dependency>

我添加了这个依赖并再次尝试“mvn install -DskipTests”。我的错误解决了。

您只需尝试在“APACHE Hadoop MR1”的 pom.xml 中添加此依赖项。愿你的错误会解决

于 2014-01-29T12:46:56.830 回答
0

似乎 Maven 编译器插件抱怨由于方法可见性而无法访问getDelegationTokenSecretManager()Hadoop中的方法,即它不是公开的:FSNameSystem

[ERROR] /home/xiu/myGit/hadoop2/hadoop-mr1-project/hadoop-mr1/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java:[153,4] getDelegationTokenSecretManager() is not public in org.apache.hadoop.hdfs.server.namenode.FSNamesystem; cannot be accessed from outside package
[INFO] 1 error

我建议您检查在 pom.xml 中定义的 Hadoop 版本,并仔细检查该方法是否真的可以在 Hadoop 版本 JavaDoc 中访问。

于 2013-07-21T01:49:24.847 回答