Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use gradle run with Intellij IDEA?

I have the following build.gradle file:

apply plugin:'application'

mainClassName = "MyMain"

allprojects {
    sourceCompatibility = 1.7
    targetCompatibility = 1.7
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.jsoup:jsoup:1.8.3'
}

So when I do gradle run it works perfectly, it uses jsoup and so.

Now, I've imported this project at my Intellij Idea IDE, I created a gradle build run/debug configuration, so when I press the green arrow 'run', it's building the application, but not running it, so I guess it's executing gradle build.

I've searched for an way to run the application, and the Intellij Idea says that I must create a new Application run/debug configuration. I did it, told where my main class was, but when I click run, it tries to make the source code, and claims that it can't find Jsoup for compiling.

How can I mimic gradle run in intellij idea's IDE?

like image 305
Gatonito Avatar asked Jul 29 '16 18:07

Gatonito


1 Answers

Open the gradle window in Intellij. View->Tool Windows->Gradle.

On the right hand side you will see a list of all your gradle tasks. Double click to run or right click and assign a shortcut to any of them.

like image 157
Matt R Avatar answered Sep 30 '22 11:09

Matt R