windowsmavenkotlinprotocol-buffersprotoc

How to solve CreateProcess error=206, The filename or extension is too long error of maven-protobuf-plugin?


How can one solve this error when building a Maven project that uses protobufs?

org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default) on project my-module: An error occurred while invoking protoc: Error while executing process.: Cannot run program "cmd.exe": CreateProcess error=206, The filename or extension is too long

I use maven-protobuf-plugin version 0.6.1, I am running IntelliJ on Windows.

I have tried to

but none worked.


Solution

  • To fix this issue set the <useArgumentFile>true</useArgumentFile> configuration option in the plugin, as mentioned here under

    Dealing with "Command line is too long" errors

    It should look like this in the pom.xml:

    <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.6.1</version>
        <configuration>                   
            <useArgumentFile>true</useArgumentFile>
        </configuration>
    

    Related GitHub issue here.