gradle生成失败,出现java ioexception

v09wglhw  于 2021-07-05  发布在  Java
关注(0)|答案(1)|浏览(923)

当我试图执行gradle.bat文件或任何gradle命令(例如gradle-version)时,我遇到了以下错误。

FAILURE: Build failed with an exception.

* What went wrong:

java.io.IOException: The filename, directory name, or volume label syntax is incorrect

渐变版本:4.10.2
jdk:“1.8.0\u 261”
操作系统:windows 10(x64)
可能出了什么问题?
p、 s:我也尝试过同样的升级版本(6.6.1)。它产生了类似的错误。

FAILURE: Build failed with an exception.

* What went wrong:

java.io.IOException: The filename, directory name, or volume label syntax is incorrect

* Try:

Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:

org.gradle.api.UncheckedIOException: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
        at org.gradle.internal.FileUtils.canonicalize(FileUtils.java:204)
        at org.gradle.initialization.BuildLayoutParameters.findGradleUserHomeDir(BuildLayoutParameters.java:51)
        at org.gradle.initialization.BuildLayoutParameters.<init>(BuildLayoutParameters.java:39)
        at org.gradle.launcher.cli.converter.BuildLayoutConverter.defaultValues(BuildLayoutConverter.java:42)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:205)
        at org.gradle.launcher.Main.doAction(Main.java:35)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
        at java.io.WinNTFileSystem.canonicalize0(Native Method)
        at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
        at java.io.File.getCanonicalPath(File.java:618)
        at java.io.File.getCanonicalFile(File.java:643)
        at org.gradle.internal.FileUtils.canonicalize(FileUtils.java:202)
        ... 13 more
xoshrz7s

xoshrz7s1#

只需在用户变量下添加gradle\u user\u home环境变量而不是系统变量,就可以解决这个问题。

相关问题