Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Gradle bootRun with --args in Intellij

Gradle 4.9 introduced the --args parameter to bootRun, which I can use easily from the command-line, but how do I use this from a Run/Debug configuration in Intellij 2018?

With a Gradle build set to run the bootRun task on my project in Intellij, I've tried the following arguments in the Run/Debug Configurations screen without any success:

  • --args 'foo'
  • --args='foo'
  • --args=foo

Output from Intellij:

9:18:56 AM: Executing task 'bootRun --args='foo''...

Unknown command-line option '--args'.
9:18:57 AM: Task execution finished 'bootRun --args='foo''.

A similar question documents the older syntax for doing this.

like image 505
ben3000 Avatar asked Sep 11 '18 01:09

ben3000


People also ask

How does Gradle bootRun work?

The Spring Boot gradle plugin provides the bootRun task that allows a developer to start the application in a “developer mode” without first building a JAR file and then starting this JAR file. Thus, it's a quick way to test the latest changes you made to the codebase.

How do I debug a Gradle project in IntelliJ?

Create a run/debug Gradle configuration From the main menu, select Add Configuration. Alternatively, right-click any task in the Gradle tool window and select Modify Run Configuration.


1 Answers

Maybe you can add your args to Tasks as bootRun --args='foo' in IDEA's Run/Debug Configurations.

My task is run --args='-h' and it works for me

like image 168
Linsama Avatar answered Oct 03 '22 07:10

Linsama