Not finding org.gradle.api.tasks.bundling.Jar in gradle-core-2.12.jar for custom plugin


I’m writing a custom plugin in Groovy that defines a new task for building a Jar file. I get no complaints from the command line (strangely, but I’m new to this world so perhaps there are other problems that are hiding this particular one), but IntelliJ does not find the org.gradle.api.tasks.bundling.Jar resource when I use this import statement:

import org.gradle.api.tasks.bundling.Jar

And indeed if I look at the gradle-core-2.12.jar file, I can see that there is, for example, an org.gradle.api.tasks.bundling.Zip class, but no sibling for the Jar class. Is it in some other Jar file that my classpath is somehow not picking up? If so, which one?

For reference, the task I’m defining looks like this:

    def Task apiJar = project.task("apiJar",
            group: "api",
            type: Jar,
            description: "produce jar file for api", {
        from project.sourceSets['api'].output.classesDir
        baseName "${}-api"
        destinationDir = project.libDir

org.gradle.api.tasks.bundling.Jar is in gradle-plugins-2.12.jar, but that should automatically be added to your classpath with gradleApi().

Ah ha! Thank you, Sterling. I did not have the lib/plugins directory in my classpath for Intellij. It’s happy now.