win下编译hadoop项目--踩过的坑

装了IDEA,一直没有配环境。最近非得搞环境了--

第一次在Terminal上运行

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

出现以下error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (pre-dist) on project hadoop-project-dist: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "sh" (in directory "D:
\gitCode\JDHadoop-2.7.1\hadoop-project-dist\target"): CreateProcess error=2, ?????????
[ERROR] around Ant part ...... @ 41:103 in D:\gitCode\JDHadoop-2.7.1\hadoop-project-dist\target\antrun\build-main.xml
[ERROR] -> [Help 1]

然后去安装cygwin64,安装过程一直点下一步就可以了,最后在IDEA的Terminal设置中,Shell path 改为cygwin64安装目录\Cygwin.bat

第二次在Terminal上运行编译命令,出现出现了 找不到 protoc 的错误,并让我用 protoc --version 测试一下。

然后去下载安装protoc,可参考此博文 windows 环境下的 protoc 安装 

安装成功后,在Terminal上运行protoc --version 有提示:

$ protoc --version
libprotoc 2.5.0

第三次在Terminal上运行编译命令,出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-common: An Ant BuildException has occured: Execute failed: java.io.IOException
: Cannot run program "cmake" (in directory "D:\gitCode\JDHadoop-2.7.1\hadoop-common-project\hadoop-common\target\native"): CreateProcess error=2, ?????????
[ERROR] around Ant part ...... @ 4:129 in D:\gitCode\JDHadoop
-2.7.1\hadoop-common-project\hadoop-common\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

下载cmake-3.12.1-win64-x64.zip,解压并将bin目录加入到path中,运行camke --version:

$ cmake --version
cmake version 3.12.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

第四次在terminal上运行编译命令,出现以下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:exec (compile-ms-winutils) on project hadoop-common: Command execution failed. Cannot run program "msbuild" (in directory "D:\gitCode\JDHadoop-2.7.1\hadoop-common-proj
ect\hadoop-common"): CreateProcess error=2, ????????? -> [Help 1]

----------------------  好吧---- 安装VSCode去............

vscode安装完就能编译了-------

你可能感兴趣的:(win下编译hadoop项目--踩过的坑)