简体   繁体   English

Gradle Wrapper ClassNotFound 但只是有时?

[英]Gradle Wrapper ClassNotFound but only sometimes?

I'm writing a script to extract some zipped files and run their gradle wrappers.我正在编写一个脚本来提取一些压缩文件并运行它们的 gradle 包装器。 At first this worked fine, but now every time I run the script, the zips extract to their directories but I get:起初这工作正常,但现在每次我运行脚本时,zip 解压缩到它们的目录,但我得到:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

I've run gradle wrapper but I get the same problem.我已经运行了gradle wrapper但我遇到了同样的问题。 My directories are fine (I've got gradle-wrapper.jar and the rest of the files).我的目录很好(我有 gradle-wrapper.jar 和其他文件)。 I've looked at most of the other threads on this problem and none of them have solved it.我已经查看了有关此问题的大多数其他线程,但没有一个解决了该问题。 Why could this be happening and how can I fix it?为什么会发生这种情况,我该如何解决?

I found out that the problem was the naming of the directory:我发现问题是目录的命名:

If the project is extracted to a directory with special characters that need to be escaped (in my case colons (:)), then gradle messes up and can't index the project properly or run the wrapper.如果项目被提取到一个包含需要转义的特殊字符的目录(在我的例子中是冒号 (:)),那么 gradle 就会混乱并且无法正确索引项目或运行包装器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM