I was trying to run a legacy project using spring version 3 with build.gradle:
...
plugins {
id 'java'
id 'maven-publish'
id 'war'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
ext {
org_springframework_version = '3.2.18.RELEASE'
}
dependencies {
...
implementation 'org.springframework.ldap:spring-ldap-core:2.4.1'
implementation "org.springframework:spring-web:${org_springframework_version}"
implementation "org.springframework:spring-webmvc:${org_springframework_version}"
implementation "org.springframework:spring:${org_springframework_version}"
...
}
...
but getting the following error when trying to build:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework:spring:3.2.18.RELEASE.
Searched in the following locations:
- file:/C:/Users/.../.m2/repository/org/springframework/spring/3.2.18.RELEASE/spring-3.2.18.RELEASE.pom
- https://repo.maven.apache.org/maven2/org/springframework/spring/3.2.18.RELEASE/spring-3.2.18.RELEASE.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I checked https://repo.maven.apache.org/maven2/org/springframework/spring/ and it looks like there is no spring 3 or 4 in the repo.
I cannot use any newer spring version as there are tons of other dependencies and legacy code in the project that should be kept as is.
I am confused as to why is this the case or how to build my project now. Any help is appreciated.
PS. A little background: I have a legacy project that relies on really old tech (Stripes framework) which is straight up refusing to work with spring 5+. It is running on Java 6 now. I want to upgrade it to java 8. But spring 2.x dependency is not letting me to.
mavenCentral()
repository?repositories { mavenLocal() mavenCentral() }
produces same issue nonetheless. Am i doing something wrong?spring.jar
nor is there now as it only contains thepom.xml
. So remove thespring
dependency and replace with things likespring-context-support
depending on your needs. Also usemavenCentral()
instead of a hardcoded URL in your repo.