4

I am using Ubuntu 14.04 and ext4 file system, which does not allow file names longer than 143 characters. There is a dependency that causes a problem due to a long file name. Here are more details:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task {task-name}
at ...
Caused by: org.gradle.api.GradleException: Could not expand ZIP '/home/{username}/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/1.3.2.RELEASE/dbd3d19d62e588b7fd495e8a3071ff076d0f74d5/spring-boot-autoconfigure-1.3.2.RELEASE.jar'.
at ...
Caused by: org.gradle.api.GradleException: Could not copy zip entry /home/{username}/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/1.3.2.RELEASE/dbd3d19d62e588b7fd495e8a3071ff076d0f74d5/spring-boot-autoconfigure-1.3.2.RELEASE.jar!org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration$DeviceDelegatingViewResolverConfiguration$ThymeleafViewResolverViewResolverDelegateConfiguration.class to '/home/{username}/{path-to-project}/build/tmp/expandedArchives/spring-boot-autoconfigure-1.3.2.RELEASE.jar_b7o429q11e8neo97xwl2h3jny/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration$DeviceDelegatingViewResolverConfiguration$ThymeleafViewResolverViewResolverDelegateConfiguration.class'.
at ... 
Caused by: java.io.FileNotFoundException: /home/{userame}/{path-to-project}/build/tmp/expandedArchives/spring-boot-autoconfigure-1.3.2.RELEASE.jar_b7o429q11e8neo97xwl2h3jny/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration$DeviceDelegatingViewResolverConfiguration$ThymeleafViewResolverViewResolverDelegateConfiguration.class (File name too long)

Gradle version is 2.12. Some other questions suggested changing the GRADLE_USER_HOME variable to point to a unencrypted location, but it seems that my whole system is encrypted and therefore does not support names longer than 143 characters.

Is there any workaround?

Ivaylo Toskov
  • 3,911
  • 3
  • 32
  • 48
  • Hi Ivaylo, since this question is now a couple of months old, I was wondering if you have found a way to solve this problem in the meanwhile? Im experiencing the exact same problem on my system. – mdewit Jun 20 '16 at 14:27
  • I saw that you already solved the problem. I found a workaround, but not a very neat one. I simply created a new user with unencrypted file system. Not a real fix, but since it was a university project, it was good enough. – Ivaylo Toskov Jun 21 '16 at 20:04

1 Answers1

0

Ok found a workaround for myself, it is to make use of the spring boot gradle plugin.

Add the following at the top of your script:

buildscript {
   dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE"
    }
}

apply plugin: 'java'
apply plugin: "spring-boot"

A task called "bootRepackage" will now be added to your project. If you have a custom jar task (to setup the manifest properties etc), add the following aswell:

bootRepackage.withJarTask = jar

Now, when you run:

gradle bootRepackage

It will take all the dependant jars and package it with your application jar into a bigger jar. If you specified a main method in your custom jar task definition, then you can now run the jar normally:

java -jar build/lib/somejar.jar

Note that the application will launch through spring boot. Hope this helps.

mdewit
  • 2,016
  • 13
  • 31