MojoExecution异常

时间:2016-08-27 08:05:46

标签: maven hadoop maven-3 maven-plugin

我用maven编译hadoop源代码时出现此错误。

我正在使用Windows 8.1,hadoop 2.7.2和visual studio 2012。

我按照此链接Maven MojoExecutionException但它没有用。

对于安装hadoop,我使用http://harishshan.blogspot.com/2014/10/install-hadoop-251-on-windows-7-64bit.html

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.7.2:prot
oc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecut
ionException: 'protoc --version' did not return a version -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :hadoop-common

1 个答案:

答案 0 :(得分:1)

该例外与Maven无关。错误消息实际上已经指向主要问题:

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.7.2:protoc \
(compile-protoc) on project hadoop-common: \
org.apache.maven.plugin.MojoExecutionException: \
'protoc --version' did not return a version -> [Help 1]

protoc Maven插件的org.apache.hadoop:hadoop-maven-plugins目标是检查PATH中protoc命令是否可用,检查最简单的常用命令:version命令:

protoc --version

看看tutorial you linked,你很可能错过了第4步:

  

步骤4:安装协议缓冲区2.5.0

或者您可能没有正确配置它,也没有通过命令PATH使其可用。

<强>更新
该教程确实没有提供有关从何处以及如何安装协议缓冲区的大量信息。

本教程描述的版本为 2.5.0 ,可用here。您可以下载Windows zip here。然后只需解压缩并将其路径添加到Windows PATH:在检查Maven构建是否会识别它之前,首先检查protoc --version是否可以从任何命令行中恢复。

另请注意:对教程的评论也指向其他错误,如果您在整个过程中仍遇到其他错误,请仔细检查它们。