Wednesday, June 7, 2017

Thrift fails on Windows - thrift failed error: The command line is too long.

Meet a thrift compiling failure on my project on Windows 7. Using Maven in IntelliJ so I choiced maven-thrift-pluging for thrift files. For one project, the thrift failed as below:

[INFO] — maven-thrift-plugin:0.1.11:compile (thrift-sources) @ xxxxxxxxxxxxxxx —
[ERROR] thrift failed output: 
[ERROR] thrift failed error: The command line is too long.

Executed the thrift --gen manually did not meet this issue, so most likely caused by how maven-thrift-plugin call the compiler. Finally I had a workaround to decrease the thrift temp file folder path to pass the build:

Below configuration changed the folder name from default "thrift-dependencies" to "td", lucky my project pass build, otherwise I think I have to move my project to a up-level folder to get a shorter path.

<plugin>    <groupId>org.apache.thrift.tools</groupId>    <artifactId>maven-thrift-plugin</artifactId>    <configuration>        <thriftExecutable>${thrift.compiler}</thriftExecutable>        <generator>${thrift.generator}</generator>        <temporaryThriftFileDirectory>${project.build.directory}/td</temporaryThriftFileDirectory>    </configuration></plugin>

Thrift fails on Windows - thrift failed error: The command line is too long.

Meet a thrift compiling failure on my project on Windows 7. Using Maven in IntelliJ so I choiced maven-thrift-pluging for thrift files. For ...