Gradle dependency for gradle api?


(Dave Bender) #1

I’m trying to get started building a Gradle plugin in Java (within Eclipse), but I’m stuck trying to define the Gradle dependency. My HelloPlugin says the imports for

import org.gradle.api.DefaultTask; import org.gradle.api.tasks.TaskAction;

cannot be found, which makes sense because I haven’t told it where to find those dependencies. But I can’t find what value I need to put into my build.gradle dependencies closure. I’ve got:

dependencies { compile 'org.slf4j:slf4j-api:1.7.21' testCompile 'junit:junit:4.12' }

I think I need a line like:

compile 'org.gradle<something else??>

But I don’t know if that’s correct or what the right value is if I’m going down right path.

Any help would be great. Thanks!


(Dave Bender) #2

I think I found something that works:

compile gradleApi()

So if I have:

dependencies { compile 'org.slf4j:slf4j-api:1.7.21' compile gradleApi() testCompile 'junit:junit:4.12' }

all seems to work.