Plugin 'java-library' not found

Hi all,

I’m having an issue as of late when compiling a java library with Gradle 4.0.1 (this issue was happening with 3.5 as well) using the ‘java-library’ plugin. Here is a snipped of my build script:

buildscript{
    repositories{
        jcenter();
    }
    dependencies{
        classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.5'
        classpath 'org.akhikhl.gretty:gretty:+'
    	classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
    }
}

configurations{
    taglibs{ transitive = false}
    enhance
}

repositories {
    mavenCentral()
}

apply plugin: 'java-library'
apply plugin: 'war'
apply plugin: 'com.bmuschko.tomcat'

sourceCompatibility = 1.7

and here is what happens when I try to build:

BUILD FAILED

Total time: 0.115 secs
Plugin with id 'java-library' not found.

This was working fine until recently. I would really appreciate some help as this is interfering with my work.

I can reproduce the error on those versions of Gradle by typing an invalid / invisible character, which seems like the most likely situation that could occur accidentally. There’s not one in your post, but the forums could have stripped it out. Maybe try deleting and re-typing the apply plugin: 'java-library' line to see if there’s any difference.

I can reproduce the error other ways as well, but not in a way one could realistically accomplish without the specific intent to cause this error, so I would think if would then be something unique about your environment that isn’t mentioned. Just what you’ve provided seems to work as expected.

1 Like

It looks like IntelliJ isn’t using the version of gradle I tell it to so I should post this issue on their form (the build script works via terminal though). Thank you for your help!

Upgrade your Gradle version. It works perfectly for me on Gradle 4.4

I encountered this issue today using Gradle 5.0. Is anyone else encountering this issue with a version of Gradle after 4.4?