2

I get this error while I compile hadoop source code with maven.

I am using windows 8.1, hadoop 2.7.2 and visual studio 2012.

I followed this link Maven MojoExecutionException but it didnt work.

For installing hadoop I use http://harishshan.blogspot.com/2014/10/install-hadoop-251-on-windows-7-64bit.html.

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.7.2:prot
oc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecut
ionException: 'protoc --version' did not return a version -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :hadoop-common
Community
  • 1
  • 1
mndn
  • 31
  • 1
  • 5

1 Answers1

2

The exception is not related to Maven. The error message is actually already pointing at the main issue:

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.7.2:protoc \
(compile-protoc) on project hadoop-common: \
org.apache.maven.plugin.MojoExecutionException: \
'protoc --version' did not return a version -> [Help 1]

The protoc goal of the org.apache.hadoop:hadoop-maven-plugins Maven Plugin is checking whether the protoc command is available in the PATH, checking the simplest common command: the version command:

protoc --version

Looking at the tutorial you linked you most probably missed Step 4:

Step 4: Install Protocol buffer 2.5.0

Or you probably didn't configure it properly, not making it available via the command PATH.


Update
The tutorial indeed doesn't provide much information about from where and how to install Protocol Buffer.

The version described by the tutorial is 2.5.0, available here. You can download the Windows zip here. Then simply unzip it and add its path to the Windows PATH: before checking whether the Maven build will then recognize it, first check whether the protoc --version would fine or not from any command line.


Also note: comments to the tutorial point to other errors as well, double check them in case you still encounter other errors in the overall process.

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
  • it says that I just download and extract in c:\protocbuf and then set in the path.and I did.can you explain more clear .thank – mndn Aug 27 '16 at 10:02
  • 1
    did you try from any console to execute the same command, `protoc --version` and check whether that works or not? – A_Di-Matteo Aug 27 '16 at 10:09
  • 'protoc' is not recognized as an internal or external command, operable program or batch file.what I should do? – mndn Aug 27 '16 at 10:12
  • that is, that means it is not available in the PATH and as such the hadoop maven plugin is failing. This also means you didn't configure it properly in the path, double check whether the command is in the `protobuf` folder or in a `bin` subfolder, the folder containing the command should actually be added to the PATH (may be the tutorial has a mistake then). – A_Di-Matteo Aug 27 '16 at 10:14
  • I checked the path it is C:\protobuf;I use the command in c:\hdfs and I add it to my path to ,but it still doesnt know protoc. – mndn Aug 27 '16 at 10:32
  • silly question: is the `C:\protobuf` folder existing? did you place it there? Did you rename it? Unzipping the file the original folder is `protoc-2.5.0-win32` – A_Di-Matteo Aug 27 '16 at 10:38
  • you mean I download version 3.0.0 and edit my path like C:\protobuf\bin ? – mndn Aug 27 '16 at 10:38
  • version 3.0.0 is for 32bit version.does it make problem? – mndn Aug 27 '16 at 10:39
  • no, it worked fine on my 64 machine, but also version 2.5.0 worked fine, so the problem is not about the version but something is wrong when configuring it into the PATH. did you double check my questions above? – A_Di-Matteo Aug 27 '16 at 10:41
  • I create protobuf folder then extract the protobuf-master there. – mndn Aug 27 '16 at 10:42
  • but is the `protoc.exe` file there? check the link in my answer to download the zip of version 2.5.0 from official site. – A_Di-Matteo Aug 27 '16 at 10:44
  • no,I think the source file had a problem.let me replace it with another version. – mndn Aug 27 '16 at 10:46
  • 1
    C:\hdfs>protoc --version libprotoc 3.0.0. thanks .but let me test it for compile. I hope it works. – mndn Aug 27 '16 at 10:49
  • it works.thanks.but I face with another problem Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:exec (c ompile-ms-winutils) on project hadoop-common.Do you have any solutions? – mndn Aug 27 '16 at 12:14