1

我需要帮助,因为我试图从过去 2-3 天解决这个问题..

我正在Windows-7 (64-bit) 机器上设置 Hadoop。这是为了尝试 R 与 Hadoop 的集成。

我按照 URL 中给出的 Hadoop 安装说明进行操作 - http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os

环境变量如下 JAVE_HOME : C:\Program Files\Java\jdk1.6.0_45 M2_HOME : C:\Hadoop\apache-maven-3.1.1 PATH : C:\cygwin64\bin;C:\Hadoop\apache-maven -3.1.1\bin;C:\Hadoop\protoc-2.5.0-win32

mvn package -Pdist,native-win -DskipTests -Dtar

我从 Windows SDK 7.1 命令提示符运行了上面的命令,并在下面出现错误......非常感谢早期帮助......

****************************************************************************************

    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO]
    [INFO] Apache Hadoop Main ................................ SUCCESS [8.893s] 
    [INFO] Apache Hadoop Project POM ......................... SUCCESS [4.782s] 
    [INFO] Apache Hadoop Annotations ......................... SUCCESS [9.500s]
    [INFO] Apache Hadoop Assemblies .......................... SUCCESS [2.145s]
    [INFO] Apache Hadoop Project Dist POM .................... FAILURE [4.141s]
    [INFO] Apache Hadoop Maven Plugins ....................... SKIPPED
    [INFO] Apache Hadoop Auth ................................ SKIPPED
    [INFO] Apache Hadoop Auth Examples ....................... SKIPPED
    [INFO] Apache Hadoop Common .............................. SKIPPED
    [INFO] Apache Hadoop NFS ................................. SKIPPED
    [INFO] Apache Hadoop Common Project ...................... SKIPPED
    [INFO] Apache Hadoop HDFS ................................ SKIPPED
    [INFO] Apache Hadoop HttpFS .............................. SKIPPED
    [INFO] Apache Hadoop HDFS BookKeeper Journal ............. SKIPPED
    [INFO] Apache Hadoop HDFS-NFS ............................ SKIPPED
    [INFO] Apache Hadoop HDFS Project ........................ SKIPPED
    [INFO] hadoop-yarn ....................................... SKIPPED
    [INFO] hadoop-yarn-api ................................... SKIPPED
    [INFO] hadoop-yarn-common ................................ SKIPPED
    [INFO] hadoop-yarn-server ................................ SKIPPED
    [INFO] hadoop-yarn-server-common ......................... SKIPPED
    [INFO] hadoop-yarn-server-nodemanager .................... SKIPPED
    [INFO] hadoop-yarn-server-web-proxy ...................... SKIPPED
    [INFO] hadoop-yarn-server-resourcemanager ................ SKIPPED
    [INFO] hadoop-yarn-server-tests .......................... SKIPPED
    [INFO] hadoop-yarn-client ................................ SKIPPED
    [INFO] hadoop-yarn-applications .......................... SKIPPED
    [INFO] hadoop-yarn-applications-distributedshell ......... SKIPPED
    [INFO] hadoop-mapreduce-client ........................... SKIPPED
    [INFO] hadoop-mapreduce-client-core ...................... SKIPPED
    [INFO] hadoop-yarn-applications-unmanaged-am-launcher .... SKIPPED
    [INFO] hadoop-yarn-site .................................. SKIPPED
    [INFO] hadoop-yarn-project ............................... SKIPPED
    [INFO] hadoop-mapreduce-client-common .................... SKIPPED
    [INFO] hadoop-mapreduce-client-shuffle ................... SKIPPED
    [INFO] hadoop-mapreduce-client-app ....................... SKIPPED
    [INFO] hadoop-mapreduce-client-hs ........................ SKIPPED
    [INFO] hadoop-mapreduce-client-jobclient ................. SKIPPED
    [INFO] hadoop-mapreduce-client-hs-plugins ................ SKIPPED
    [INFO] Apache Hadoop MapReduce Examples .................. SKIPPED
    [INFO] hadoop-mapreduce .................................. SKIPPED
    [INFO] Apache Hadoop MapReduce Streaming ................. SKIPPED
    [INFO] Apache Hadoop Distributed Copy .................... SKIPPED
    [INFO] Apache Hadoop Archives ............................ SKIPPED
    [INFO] Apache Hadoop Rumen ............................... SKIPPED
    [INFO] Apache Hadoop Gridmix ............................. SKIPPED
    [INFO] Apache Hadoop Data Join ........................... SKIPPED
    [INFO] Apache Hadoop Extras .............................. SKIPPED
    [INFO] Apache Hadoop Pipes ............................... SKIPPED
    [INFO] Apache Hadoop Tools Dist .......................... SKIPPED
    [INFO] Apache Hadoop Tools ............................... SKIPPED
    [INFO] Apache Hadoop Distribution ........................ SKIPPED
    [INFO] Apache Hadoop Client .............................. SKIPPED
    [INFO] Apache Hadoop Mini-Cluster ........................ SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 32.981s
    [INFO] Finished at: Thu Feb 13 14:06:51 IST 2014
    [INFO] Final Memory: 32M/190M
    [INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (pre-dist) on project hadoop-project-dist: 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 (pre-dist) on project hadoop-project-dist: 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: C:\Hadoop\hdfs\hadoop-project-dist\target\antrun\build-main.xml:31: 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.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.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
[ERROR]
[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-project-dist

提前感谢戈帕尔

4

4 回答 4

2

你解决了问题吗?我在安装 Hadoop 时遇到了类似的问题。我发现构建源文件阶段的所有问题都与Path变量设置有关。

1. 确保您安装了 JDK,不仅 JRE 可用

2. 如果您按照此链接上的说明进行操作,则需要一个额外的路径设置:http: //www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft -windows-os : 将 .NET MsBuild.exe 主目录添加到 Path,它应该类似于 C:\Windows\Microsoft.NET\Framework64\v4.030319

3. 检查所有路径值是否已更正。在我的安装过程中,我遇到了一个与 Cygwin 路径有关的问题,cygwin 安装在名为 cygwin64 的文件夹中,但一开始我只是添加了 cygwin 作为路径值,我花了一些时间才弄清楚。

于 2014-06-10T06:21:50.003 回答
2

我使用以下命令,它成功了。

mvn clean package -DskipTests -Dtar
于 2016-12-11T03:07:32.837 回答
1

“mvn package -Pdist,native-win -DskipTests -Dtar” 根据此命令,您正在尝试编译和打包“native library”(native-win 关键字),并且要执行此操作,您给定链接中给出的任何包都不够。

要解决此问题,您有两种选择:

1) 不需要原生库,hadoop 将使用“builtin-java 类”而不是原生库。使用这个命令:“mvn package -Pdist -DskipTests -Dtar”而不是你的

2)如果您想使用本机库 - 遵循本机库指南。这里提供了构建本机库所需的所有包和其他重要信息。

我的建议是使用第一个选项,因为我在某处读到在 Windows 上构建本机库有很多问题,而不是在 Windows 上首选。

阅读 Hadoop src 文件夹中的“Building.txt”,它可以帮助您使用各种命令进行打包。

以上可能是您问题的解决方案。尝试一下

于 2014-02-13T13:45:22.583 回答
1

我有同样的错误。当我使用-X运行mvn package -Pdist,native-win -DskipTests -Dtar时,maven 向我展示了执行dist-copynativelibs.sh脚本存在一些问题。

问题是 Windows 命令提示符不能运行 sh 命令,而只能运行 bash 命令。不知道为什么 - Cygwin 已正确安装并添加到路径中。所以我在 pom 文件 D:\hdfs\hadoop-project-dist\pom.xml 中将 executable="sh" 更改为 executable="bash":

<exec executable="bash" dir="${project.build.directory}" failonerror="true">
<arg line="./dist-copynativelibs.sh"/>
</exec>

并且构建成功了。

于 2016-03-01T16:41:04.563 回答