最近在研究hadoop,在用maven编译源码的过程中出现了个错误,一直编译过不去:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:58.734s
[INFO] Finished at: Tue Jan 08 18:39:18 CST 2013
[INFO] Final Memory: 29M/71M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile-proto) on project hadoop-common: An Ant BuildException has occured: exec returned: 127 -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-common
各种查找之后,经过网上的大量查找之后发现原因:
原因:hadoop-1.0.1需要maven3.0+和protoc2.4+,以上错误是protoc版本过低导致的.
The Maven embedder provider with the system plugin ($IDEA_HOME/plugins/maven/lib) is named maven-embedder-1.1-SNAPSHOT.jar, which seems a rather bad version for a released project.
But the big issue for us is that is is bundling Maven 2.2.1.
When using the maven-enforcer-plugin in a project, and forcing Maven version to be >= 3.0.2, the _generate sources_ action, which used the Maven embedder, fails saying: Detected Maven Version: 2.2.1 is not in the allowed range 3.0.2.
Unlike before, decent Maven embedders now exist (http://repo1.maven.org/maven2/org/apache/maven/maven-embedder/)
As we are using XMLBeans in some modules, that leads to compile issues.
Workaround: Use "external" Maven runner (lifecycle phases launch), but that is really annoying.
Could it be possible to update the embedder, or being able to choose to always use the external runner?
于是马上重新安装了protoc2.4(转)
第一部分:windows7 安装 protocol buffer (如果没有安装Maven,先安装maven,并且maven -version 验证安装成功)
1. 下载地址: http://code.google.com/p/protobuf/downloads/list 。从这里下载protobuf-2.4.1.tar.gz 和 protoc-2.4.1-win32.zip 两个包。分别解压到各自目录。
2. 将protoc-2.4.1-win32中的protoc.exe拷贝到c:\windows\system32中。