Aym*_*rif 6 java gradle build.gradle gradle-plugin
我在跑步 gradle bootRun
gradle bootRun --args='--spring.profiles.active=local' --stacktrace
Run Code Online (Sandbox Code Playgroud)
我得到一个 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
Run Code Online (Sandbox Code Playgroud)
我的配置: - Gradle 版本:4.9 - JDK 版本:jdk1.8.0_111 - Windows 10
小智 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'
}
Run Code Online (Sandbox Code Playgroud)
您可能会遇到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
然后简单指定主类。例如
springBoot {
mainClassName = 'com.example.SpringBootApplication'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1477 次 |
| 最近记录: |