java编译hadoop原生maven插件查找错误

cgvd09ve  于 2021-06-04  发布在  Hadoop
关注(0)|答案(3)|浏览(314)

我试图编译hadoop,但是在ant插件中有一个maven错误。我从未使用过maven或ant,而且这个错误似乎没有给出任何错误所在的指示。错误输出在post的末尾。
我已经在pom文件中搜索了maven antrun插件(有54个pom.xml文件带有这个字符串)。这个错误表明它在 hadoop-common 但是在这个文件中有几个maven-antrun插件。我不知道哪个是问题所在,maven错误掩盖了任何失败的命令所给出的实际错误消息。
如何:
准确找出导致错误的行
获取实际的错误输出,而不是maven的无用错误
错误如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has occured: exec returned: 2 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has occured: exec returned: 2
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    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:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: exec returned: 2
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:283)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: /Users/justinmrkva/hadoop-2.2.0-src/hadoop-common-project/hadoop-common/target/antrun/build-main.xml:7: exec returned: 2
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:650)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:676)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:502)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:270)
    ... 21 more
h9a6wy2h

h9a6wy2h1#

确保已在计算机中安装了cmake。如果您使用的是ubuntu,那么可以使用以下命令安装cmake

sudo apt-get install cmake

安装后,请尝试编译。。。

t8e9dugd

t8e9dugd2#

正如@user3540568所暗示的,您可能遇到了cmake的问题。一旦我遇到这个问题,我就可以在maven输出中向上滚动,并找到一个错误,有效地说在路径中找不到“cmake”。它看起来像这样:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in directory "/home/users/tharsch/git/hadoop-common/hadoop-common-project/hadoop-common/target/native"): error=2, No such file or directory -> [Help 1]

但是,当我收到消息时,我并没有使用-e或-x运行。
这篇博文详细描述了从源代码构建hadoop2.2.0所需的一切。

0h4hbjxa

0h4hbjxa3#

mvn -e -X ....

可以帮助您定位错误,特别是'-x'标志。 mvn --help :

-X,--debug                        Produce execution debug output

不过,它将产生相当多的产出。

相关问题