Dependency problem

I’ve installed the latest STS on Windows and have tried installing the Gradle plugin a variety of ways - by doing it first and starting over and installing the Groovy plugin first because I read that somewhere. Either way, when I try to import a Grails project into my workspace and press the Build Model button, I receive the following error:

Could not resolve all dependencies for configuration ‘:classpath’. > Could not find group:bmuschko, module:gradle-tomcat-plugin, version:0.9.3. Required by: :bookstore:unspecified > Could not find group:bmuschko, module:gradle-cargo-plugin, version:0.5.4. Required by: :bookstore:unspecified

Do you have any idea how I can fix this?

Duplicate of http://stackoverflow.com/questions/24537373/importing-gradle-project-into-spring-tool-suite-leads-to-dependency-error (which currently has -5 votes).

You will need to Gradle where to find plugins used by your build. http://www.gradle.org/docs/current/userguide/custom_plugins.html#N167CE can help you with that. Look for buildscript sections there.

The build you are using depends on very old versions of two plugins:

The artifacts with these versions had been made available through the download section of GitHub. However, GitHub removed that feature at some point of time. That’s why you see your build fail. The issue is not related to the use SpringSource STS.

Both plugins are now available through Bintray’s JCenter. Please refer to the documentation provided above to set the correct repository in your build plus an up-to-date version of the plugin.

Can someone elaborate please . I am sure everyone in the world who bought pro spring mvc book has this question. The book uses gradle , most users do not know the gradle build script and should be struggling with this error.

The source code of this book needs to be fixed. The ‘build.gradle’ file still points to an old version and repository of the plugins that are not available anymore. Would you mind contacting the author of the book to have him fix the source code?

If you want to fix it locally on your machine, change the configuration as follows:

buildscript {
    repositories {
        jcenter()
    }
      dependencies {
         classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4'
        classpath 'org.gradle.api.plugins:gradle-cargo-plugin:1.5.1'
    }
}

I am still getting the same error. The error is

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\Users\Rachit\Downloads\9781430241553 (1)\mdeinum-pro-spring-mvc-code-5d01f03\build.gradle’ line: 18

  • What went wrong: A problem occurred evaluating root project ‘bookstore’. > Could not find method jcenter() for arguments [] on repository container.

The entire debug log is pasted here http://pastebin.com/ZRfzk1Z6

The method ‘jcenter()’ is only available in Gradle 1.7 and up. The book code however uses Gradle 1.0. You can either upgrade the Gradle wrapper version or configure the JCenter URL directly as shown below:

buildscript {
    repositories {
        maven { url 'http://jcenter.bintray.com/' }
    }
}

FYI: I also sent a mail to the author of the book asking him to update the source code.

Actually the most recent version use Gradle 1.6 not sure if upgrading the version of gradle would help (or break the build).

Anyway I updated the dependencies and added the repository to the buildscript. Most recent version of the code is, as always on https://github.com/mdeinum/pro-spring-mvc-code/. Haven’t had the opportunity to test it yet (currently at work, strict firewall rules and stuff) but I guess it should (just) work.

Thanks for looking into it. I just had a look at the ZIP file on the Apress book page. That should be updated as well.

A big THANK YOU.It works now.