Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Because I'm such a newb at this, the problem is context. Their example doesn't match my build. I've installed the jar locally so it should definitely be available.

My project looks like:

    allprojects  {
        apply plugin: 'maven'
        apply plugin: "io.spring.dependency-management"
        group = 'com.wnp'
        version = '6.5.0-SNAPSHOT'
    subprojects {
        apply plugin: 'java'
        sourceCompatibility = System.getProperty("java.version")
        targetCompatibility = System.getProperty("java.version")
        repositories {
            mavenLocal()
            mavenCentral()
            jcenter()         
        dependencyManagement {
            imports {
                mavenBom 'org.springframework.ws:spring-ws:2.1.4.RELEASE'
                mavenBom 'org.jboss.as:jboss-as-jms-client-bom:7.5.0.Final-redhat-21'
            dependencies {
                dependency "antlr:antlr:2.7.7" 
apply plugin: "io.spring.dependency-management"

Their project looks like:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
  dependencies {
    classpath "io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE"
apply plugin: "io.spring.dependency-management"

What I'm getting from the system is :

Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'io.spring.dependency-management' not found.

Clues? What does "buildscript" represent? Is that a task? I've tried putting the "dependencies" section just about everywhere. Same goes with the "apply plugin:" line. Is my dependencyManagement section in the right place? One of the things I keep seeing is "dependencies cannot be applied to closure" which is pretty unhelpful as far as error messages go.

What you need to do is to define a dependency for build.gradle itself that has the plugin you're looking for. It may be e.g.:

buildscript {
   repositories {
      mavenCentral()
   dependencies {
      classpath 'io.spring.gradle:dependency-management-plugin:0.5.3.RELEASE'
allprojects  {
   apply plugin: 'maven'
   apply plugin: "io.spring.dependency-management"
   group = 'com.wnp'
   version = '6.5.0-SNAPSHOT'
                Good to know. It seems to work now. Thanks for info regarding buildscript. Not found anywhere else. Probably assuming I know Groovy but like many, Gradle is my reason for learning Groovy as well so I get both barrels. :-/
– user447607
                Nov 10, 2015 at 19:37
                After Implementing the above scenario : Could not find org.grails.plugins:hibernate5:6.0.2. Searched in the following locations:   - https://repo.maven.apache.org/maven2/org/grails/plugins/hibernate5/6.0.2/hibernate5-6.0.2.pom   - https://repo.maven.apache.org/maven2/org/grails/plugins/hibernate5/6.0.2/hibernate5-6.0.2.jar   - https://plugins.gradle.org/m2/org/grails/plugins/hibernate5/6.0.2/hibernate5-6.0.2.pom   - https://plugins.gradle.org/m2/org/grails/plugins/hibernate5/6.0.2/hibernate5-6.0.2.jar Required by:     project :
– iUbaid
                Mar 6, 2019 at 7:16

Take a look at the official user guide, section called "external dependencies". According to it:

If your build script needs to use external libraries, you can add them to the script's classpath in the build script itself. You do this using the buildscript() method, passing in a closure which declares the build script classpath.

In your case,a plugin is an external dependency, and you have to provide buildscript section for all the project, which need to apply this plugin.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.