Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle task `bootrun` setup in IntelliJ

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

like image 897
Ayman Arif Avatar asked Apr 06 '20 10:04

Ayman Arif


People also ask

How do I add a task in Gradle IntelliJ?

While in the Keymap dialog, you can add a new task to which you want to assign a shortcut. In the Keymap dialog, under the Gradle node, click Choose a task to assign a shortcut. In the dialog that opens, select a task you need and click OK. The task is added to the list under the Gradle node.

How do I view Gradle tasks in IntelliJ?

Click Gradle on the right sidebar to open the tool window. The tool window displays the Gradle linked projects, their tasks, dependencies, and all changes made to the underlying build. gradle file.


1 Answers

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'
}
like image 134
K D Avatar answered Oct 23 '22 09:10

K D