编译Hadoop本机 - 在Maven插件中查找错误

时间:2014-02-27 12:07:11

标签: java maven hadoop ant

我正在尝试编译Hadoop,并且在ant插件中存在Maven错误。我从来没有使用过Maven或者蚂蚁,而且这个错误似乎没有给出任何错误指示。错误输出位于帖子的末尾。

我在pom文件中搜索了maven-antrun-plugin(有54个带有该字符串的pom.xml文件)。该错误表明它位于hadoop-common下面,但在该文件中有几个maven-antrun-plugin出现。我不知道哪个是问题,并且Maven错误掩盖了实际的错误消息,即无论命令失败都会给出。

我如何:

  1. 确切地找到导致错误的行
  2. 获取实际的错误输出而不是Maven的无用错误
  3. 这是错误:

    [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
    

3 个答案:

答案 0 :(得分:5)

确保您已在机器中安装了cmake。 如果您使用的是Ubuntu,可以使用以下命令安装cmake

sudo apt-get install cmake

安装后,尝试编译......

答案 1 :(得分:1)

mvn -e -X ....

可以帮助您找到错误,特别是'-X'标志。 mvn --help

-X,--debug                        Produce execution debug output

但它会产生相当多的输出。

答案 2 :(得分:0)

正如@ 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运行。

这个blog post详细描述了从源代码构建hadoop 2.2.0所需的内容。