hadoop windows org.codehaus.mojo:exec-maven-plugin

2019-08-06 14:23发布

问题:

I am trying to install hadoop on my windows machine. I am following this guide: https://wiki.apache.org/hadoop/Hadoop2OnWindows but when I have to execute this line:

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

I have this error:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (com
pile-ms-winutils) on project hadoop-common: Command execution failed. Process ex
ited with an error: 1(Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
I already read this post build hadoop 2.2 on windows but I am not able to understand how to solve.

Thank you in advance for your help.

Alex

回答1:

You ran that command from a Windows SDK Command Prompt, right? Taking a look at this guide I wrote recently and make sure you have the proper tools installed.



回答2:

If you are using recent versions of Hadoop, i.e. Hadoop-2.8, or 2.7 then there is no need to built the Hadoop-src using Maven, there is an easy way to configure (higher versions) Hadoop in windows.

Download & Install Java in c:/java/

make sure the path is this way, if java is installed in program files, then hadoop-env.cmd will not recognize java path

Download Hadoop binary distribution.

I am using binary distribution Hadoop-2.8.1

Set Environment Variables:

JAVA_HOME = "c:/Java"
HADOOP_HOME="<your hadoop home>"
Path= "JAVA_HOME/bin"
Path = "HADOOP_HOME/bin" 

Hadoop will work on windows if Hadoop-src is built using maven in your windows machine. Building the Hadoop-src(distribution) will create a Hadoop binary distribution, which will work as windows native version.

But if you don't want to do that, then download pre-builted winutils of Hadoop distribution. Here is a GitHub link, which has winutils of some versions of Hadoop.

if the version you are using is not in the list, the follow the conventional method for setting up Hadoop on windows - link

If you found your version, then copy paste all content of folder into path: /bin/

Set all the .xml configuration files - Link & set JAVA_HOME path in hadoop-env.cmd file

From cmd go to:

<HADOOP_HOME>/bin/> hdfs namenode -format
<HADOOP_HOME>/sbin> start-all.cmd

Hope this helps.