I am trying to setup a new Java project using Gradle as the build tool. For this post, lets assume that the project needs to use Hibernate [hibernate-core] and Spring [spring-core].
build.gradle
def localMavenRepo = "file://opt/m2/repository"
allprojects {
apply plugin: "java"
repositories {
maven {
url localMavenRepo
}
}
dependencies {
compile "org.hibernate:hibernate-core:3.5.0-CR-2"
compile "org.springframework:spring-core:3.0.5-RELEASE"
}
}
When I run gradle-build I get the following:
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all dependencies for configuration ‘:testRuntime’.
Could not find group:org.springframework, module:spring-core, version:3.0.5-RELEASE.
Required by:
:gradle_spring_bug:unspecified
The puzzling part is that it finds the hibernate-core artifact in the repository but not the spring-core one.
I am thinking that perhaps the Spring jar itself is to blame.
Here is what I have tried so far:
-
Change the Maven repository. I am at work at the moment and we using a Maven Proxy repository. I have tried both local and remote repositories. Problem still exists.
-
Change the Spring version. I have tried different versions of the
spring-coredependency (3.0.1-RELEASE, 3.0.3-RELEASE). Problem still exists. -
Change the Spring artifact. I have tried the
org.springframework.spring-jdbcandorg.springframework.security.spring-security-cas-clientartifacts as well. Problem still exists. -
Verify that it is Spring by trying different artifacts. I have tried ‘junit’, ‘hibernate-core’, ‘hibernate-validator’, ‘javaee-web-api’. Some with different versions. Pointing them to either local or remote repositories and they all work.
What I haven’t tried yet:
-
Change the version of Gradle
I am using the latest version of Gradle1.0-rc-3 -
Try the Maven central repo
Need to configure my proxy but that’s my next step. However, I am not too optimistic that it will work.
Would be great if somebody with the latest version of Gradle could try it out and let me know if they are experiencing the same issue.
EDIT
SOLVED : Double check version declaration. Spring 3.0.5-RELEASE doesn’t exist. It’s 3.0.5.RELEASE.
P.S – Don’t have enough points to answer my own question within less than 8 hours.
Double check version declaration. Spring 3.0.5-RELEASE doesn’t exist. It’s 3.0.5.RELEASE