Home > Enterprise >  How to solve CreateProcess error=206, The filename or extension is too long error of maven-protobuf-
How to solve CreateProcess error=206, The filename or extension is too long error of maven-protobuf-

Time:02-06

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

  • add -Didea.dynamic.classpath=true to the mvn clean install
  • command add "dynamic.classpath": "true" to PropertiesComponent in workspace.xml of IntelliJ
  • install a newer version of the protoc compiler
  • build from terminal outside Intellij
  • updating IntelliJ

but none worked.

CodePudding user response:

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.

  • Related