java org.apache.maven.plugin.MojoExecutionException:协议失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15745010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.apache.maven.plugin.MojoExecutionException: protoc failure
提问by huang
I meet some problems when i use maven to complie hadoop from source code.Here is the error, can anyone help me? Thanks.
当我使用 maven 从源代码编译 hadoop 时遇到一些问题。这是错误,有人可以帮助我吗?谢谢。
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-c
[Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAP
plugin.MojoExecutionException: protoc failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.apache.maven.plugin.MojoExecutionException: protoc failure
at org.apache.hadoop.maven.plugin.protoc.ProtocMojo.execute(ProtocMojo.java:81)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
**Caused by: org.apache.maven.plugin.MojoExecutionException: protoc failure**
at org.apache.hadoop.maven.plugin.protoc.ProtocMojo.execute(ProtocMojo.java:78)
... 21 more
[ERROR]
[ERROR]
回答by jayunit100
The instructions at http://wiki.apache.org/hadoop/HowToContributeexplain some of the less obvious aspects of building hadoop - including this one. The main problem here is that Protocol Buffers are required by hadoop's YARN framework, and you most likely do not have them installed.
在该指令http://wiki.apache.org/hadoop/HowToContribute解释一些建筑的Hadoop的不太明显的方面-包括这一项。这里的主要问题是 hadoop 的 YARN 框架需要协议缓冲区,而您很可能没有安装它们。
It seems like the problem might be that your not interpretting the error correctly, so --
问题似乎是你没有正确解释错误,所以——
How to Isolate the Build error
如何隔离构建错误
Any mojo which fails should be associated with a class.
任何失败的 mojo 都应该与一个类相关联。
In this case, the mojo that is failing is here :
在这种情况下,失败的魔力在这里:
Looking at the code, its clear that this Mojo requires the "protoc" program to run.
查看代码,很明显这个 Mojo 需要“protoc”程序才能运行。
http://code.google.com/p/protobuf/
http://code.google.com/p/protobuf/
Solution
解决方案
To build hadoop, you need protocol buffers. This can be installed on a *NIX machine from source, by running the following commands to grab the code from googlecode (taken from http://numbers.brighterplanet.com/2012/04/14/how-to-install-mosh-on-amazon-ec2/).
要构建 hadoop,您需要协议缓冲区。这可以从源代码安装在 *NIX 机器上,通过运行以下命令从 googlecode 中获取代码(取自http://numbers.brighterplanet.com/2012/04/14/how-to-install-mosh-在亚马逊 ec2/ 上)。
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz
tar xzf protobuf-2.4.1.tar.gz
cd protobuf-2.4.1
./configure
make
sudo make install
sudo ldconfig