Could not compile build file: File name to long

I’m trying to build spring-integration, basically:

git clone https://github.com/spring-projects/spring-integration.git
cd spring-integration
git checkout 0c9dda45e34c3d
./gradlew build

But this fails always with “File name to long”

spring-integration $ ./gradlew build
        >> ~/data/code/spring-integration
  FAILURE: Build failed with an exception.
  * Where:
Build file '/data/flo/code/spring-integration/build.gradle'
  * What went wrong:
Could not compile build file '/data/flo/code/spring-integration/build.gradle'.
> startup failed:
  /home/flo/.gradle/caches/1.12/scripts/build_4221t4fhf8s71i2mr2d1f2uo5k/ProjectScript/no_buildscript/classes/build_4221t4fhf8s71i2mr2d1f2uo5k$_run_closure33_closure123_closure124_closure125_closure126_closure127_closure128_closure129_closure131_closure132.class (File name too long)

The used gradle version is 1.12.

This problem, or at least a very similar one, seems to existed in 2010: - http://gradle.1045684.n5.nabble.com/File-name-too-long-errors-on-classes-in-Gradle-cache-td3318077.html - http://forum.spring.io/forum/spring-projects/web/social/92765-problem-building-spring-social-with-gradle

It was also with spring, but it appears to me more like a gradle issue, so I decided to first ask here.

Sounds like a limitation of your file system (settings), together with an unusually deeply nested build script.

Peter’s post was also my conclusion. But I wondered why this would happen on my non-exotic ext4 filesystem with a maximum filename length of 255 chars, where my local git repositories reside. Then I noticed that the too long filename was only 33 chars and was not part of the filesystem, but where in ~/.gradle. My home filesystem is a ecryptfs, which apparently doesn’t allow filenames of that length.

After moving ~/.gradle/caches/ to a non-ecryptfs partition and creating a symlink everything works :slight_smile:

Alternatively, you could set the ‘GRADLE_USER_HOME’ env variable (default is ‘~/.gradle’).

Hello

Long path tool is the best solution for your problem. try it and solve your problem ________________