我正在使用Ubuntu 14.04
和ext4
文件系统,该文件系统不允许超过143个字符的文件名。由于文件名较长,存在导致问题的依赖项。以下是更多细节:
* 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版本为2.12
。其他一些问题建议将GRADLE_USER_HOME
变量更改为指向未加密的位置,但似乎我的整个系统都是加密的,因此不支持超过143个字符的名称。
有解决方法吗?
答案 0 :(得分:0)
Ok为自己找到了一个解决方法,就是使用spring boot gradle插件。
在脚本顶部添加以下内容:
buildscript {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE"
}
}
apply plugin: 'java'
apply plugin: "spring-boot"
一项名为" bootRepackage"的任务现在将添加到您的项目中。如果您有自定义jar任务(设置清单属性等),请添加以下内容:
bootRepackage.withJarTask = jar
现在,当你跑:
gradle bootRepackage
它将需要所有相关的罐子并将它与您的应用程序罐一起打包到一个更大的罐子里。如果在自定义jar任务定义中指定了main方法,那么现在可以正常运行jar:
java -jar build / lib / somejar.jar
请注意,应用程序将通过spring boot启动。希望这会有所帮助。