我在我的树莓派上 checkout 了这个示例Jetty-gradle bases服务器应用程序https://github.com/rominirani/GradleWebAppSample,希望运行一个Java服务器。但是,构建失败并显示以下错误:
建立失败
总时间:59.558秒
完整的堆栈跟踪(在 Debug模式下):在http://www.heypasteit.com/clip/0IIKXC中可用
截断的堆栈跟踪:
22:35:22.774 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on task artifact state cache (/home/pi/projects/ixrobotserver2.0/.gradle/1.5/taskArtifacts).
22:35:22.789 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
22:35:22.802 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':utils:jar'
22:35:22.815 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :utils:jar FAILED
22:35:22.864 [ERROR] [org.gradle.BuildExceptionReporter]
22:35:22.880 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
22:35:22.895 [ERROR] [org.gradle.BuildExceptionReporter]
22:35:22.905 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
22:35:22.917 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':utils:jar'.
22:35:22.929 [ERROR] [org.gradle.BuildExceptionReporter] > Could not add file '/home/pi/projects/ixrobotserver2.0/utils/build/classes/main/com' to ZIP '/home/pi/projects/ixrobotserver2.0/utils/build/libs/utils.jar'.
22:35:22.967 [ERROR] [org.gradle.BuildExceptionReporter]
22:35:22.977 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
22:35:23.011 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':utils:jar'.
22:35:23.022 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:72)
22:35:23.034 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:49)
22:35:23.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute
....
22:35:23.717 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.GradleException: Could not add file '/home/pi/projects/ixrobotserver2.0/utils/build/classes/main/com' to ZIP '/home/pi/projects/ixrobotserver2.0/utils/build/libs/utils.jar'.
22:35:23.730 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.file.archive.ZipCopySpecVisitor.visitDir(ZipCopySpecVisitor.java:74)
22:35:23.742 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.file.copy.NormalizingCopySpecVisitor.maybeVisit(NormalizingCopySpecVisitor.java:65)
22:35:24.037 [ERROR] [org.gradle.BuildExceptionReporter] ... 57 more
22:35:24.046 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.UnsupportedOperationException: No such file or directory - /home/pi/projects/ixrobotserver2.0/utils/build/classes/main/com
22:35:24.057 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.nativeplatform.filesystem.PosixUtil$POSIXHandlerImpl.error(PosixUtil.java:38)
22:35:24.067 [ERROR] [org.gradle.BuildExceptionReporter] at org.jruby.ext.posix.JavaLibCHelper.stat(JavaLibCHelper.java:186)
22:35:24.076 [ERROR] [org.gradle.BuildExceptionReporter] at org.jruby.ext.posix.JavaPOSIX.stat(JavaPOSIX.java:223)
22:35:24.085 [ERROR] [org.gradle.BuildExceptionReporter] at org.jruby.ext.posix.LazyPOSIX.stat(LazyPOSIX.java:227)
22:35:24.095 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.nativeplatform.filesystem.LibCStat.getUnixMode(LibCStat.java:41)
22:35:24.104 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.getUnixMode(GenericFileSystem.java:62)
22:35:24.114 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.file.DefaultFileTreeElement.getMode(DefaultFileTreeElement.java:66)
22:35:24.124 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.file.copy.MappingCopySpecVisitor$FileVisitDetailsImpl.getMode(MappingCopySpecVisitor.java:164)
22:35:24.134 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.file.archive.ZipCopySpecVisitor.visitDir(ZipCopySpecVisitor.java:70)
22:35:24.144 [ERROR] [org.gradle.BuildExceptionReporter] ... 82 more
22:35:24.153 [ERROR] [org.gradle.BuildExceptionReporter]
22:35:24.161 [LIFECYCLE] [org.gradle.BuildResultLogger]
22:35:24.170 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
22:35:24.180 [LIFECYCLE] [org.gradle.BuildResultLogger]
22:35:24.189 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 1 mins 3.162 secs
22:35:24.211 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task artifact state cache (/home/pi/projects/ixrobotserver2.0/.gradle/1.5/taskArtifacts).
...
22:35:24.384 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@1e02678, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@fdc382, org.gradle.logging.internal.JavaUtilLoggingConfigurer@2e9485]
最佳答案
我将gradle升级到3.5(从1.5),错误消失了。发生问题是因为Raspbian的apt-get默认安装gradle 1.5版本。
关于java - Gradle构建执行失败:Raspbian OS上的 “Could not add file to ZIP”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44098797/