英文:
Gradle task `bootrun` setup in IntelliJ
问题
我正在运行 gradle bootRun
gradle bootRun --args='--spring.profiles.active=local' --stacktrace
我遇到了一个 CreateProcess error=206,文件名或扩展名太长异常
启动 Gradle Daemon,1 个不兼容和 1 个已停止的 Daemon 无法重用,请使用 --status 以获取详细信息
> 任务:bootRun 失败
失败:任务执行失败:':bootRun'。
> 发生了什么:
执行任务时发生问题 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
* 尝试:
使用 --info 或 --debug 选项运行以获取更多日志输出。 使用 --scan 以获取完整的洞察信息。
* 异常是:
org.gradle.api.tasks.TaskExecutionException:执行任务失败':bootRun'。
在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110) 中
在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77) 中
...
由于:org.gradle.process.internal.ExecException:启动进程时发生问题 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
在 org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:231) 中
在 org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209) 中
在 org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:355) 中
在 org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85) 中
在 org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42) 中
... 3 more
由于:net.rubygrapefruit.platform.NativeException:无法启动 'C:\JDK8\jdk1.8.0_111\bin\java.exe'
在 net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) 中
在 net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22) 中
在 net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) 中
在 org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67) 中
... 4 more
由于:java.io.IOException:无法运行程序 "C:\JDK8\jdk1.8.0_111\bin\java.exe"(在目录 "C:\Users\E080978\git\order-management-api" 中):CreateProcess 错误=206,文件名或扩展名过长
在 net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) 中
... 7 more
由于:java.io.IOException:CreateProcess 错误=206,文件名或扩展名过长
... 8 more
我的配置:
- Gradle 版本:4.9
- JDK 版本:jdk1.8.0_111
- Windows 10
英文:
I am running gradle bootRun
gradle bootRun --args='--spring.profiles.active=local' --stacktrace
I am getting a CreateProcess error=206, The filename or extension is too long exception
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :bootRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> A problem occurred starting process 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
...
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:231)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:355)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\JDK8\jdk1.8.0_111\bin\java.exe'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
... 4 more
Caused by: java.io.IOException: Cannot run program "C:\JDK8\jdk1.8.0_111\bin\java.exe" (in directory "C:\Users\E080978\git\order-management-api"): CreateProcess error=206, The filename or extension is too long
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 7 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
... 8 more
My configurations:
- Gradle Version: 4.9
- JDK Version: jdk1.8.0_111
- Windows 10
答案1
得分: 1
自从您在Windows上使用Gradle后,如果类路径中有大量的依赖项,您可能会遇到此错误。这是由于执行命令中字符数的限制所致。
尝试来自另一个线程的解决方案:
plugins {
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
apply plugin: "com.github.ManifestClasspath"
springBoot {
mainClassName = 'com.pb.ngp.identity.manager.KeyManagerApplication'
}
您可能会遇到以下错误:
org.gradle.api.tasks.TaskExecutionException: 执行任务“:bootRun”时失败。
Caused by: org.gradle.api.InvalidUserDataException: 未配置主类名,且无法解析
然后只需指定主类。例如:
springBoot {
mainClassName = 'com.example.SpringBootApplication'
}
英文:
Since you are using Gradle on windows, you may encounter this error if you have a large number of dependencies in your classpath. This is due to the limitation on number of characters in executing command.
Try this solution from another thread:
plugins {
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
apply plugin: "com.github.ManifestClasspath"
springBoot {
mainClassName = 'com.pb.ngp.identity.manager.KeyManagerApplication'
}
You may encounter following error:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
Caused by: org.gradle.api.InvalidUserDataException: Main class name has not been configured and it could not be resolved
Then simply specify the main class. e.g.
springBoot {
mainClassName = 'com.example.SpringBootApplication'
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论