Ant BuildException Cannot run program “..\src\protoc”

Error that I am getting when trying to run mvn test on google protobuf library.

[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "..\src\protoc": CreateProcess error=2, The system c
annot find the file specified
 
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch

I did place protoc.exe in the src directory. As a side note this is running on windows machine.

Quick solution that I found was to edit the pom.xml file and modify the Ant tast into

      <mkdir dir="target/generated-sources" />
                <exec executable="./src/protoc.exe">

7 thoughts on “Ant BuildException Cannot run program “..\src\protoc””

  1. 10x
    I wouldn’t have be able to do it, alone!

    I was screaming into the monitor, already.

    It’s not documented at all, how to compile this .jar thing:
    So just use Maven in protobuf-2.4.1\java , but first put the protoc in protobuf-2.4.1\src.

  2. Fuzzy ANalysis

    Lifesaver! Thanks so much.

    P.S. you will also need to change the reference to protoc.exe wherever you see

    … in the .pom file, if you want to do other things (test etc).

    Cheers 🙂

  3. I have protoc.exe file in src folder.
    And also I mentioned the path to protoc in pom.xml as “../src/protoc.exe”.
    I am still getting the same error.
    I am running in windows.

Leave a Comment

Your email address will not be published. Required fields are marked *