我正在尝试将我的 Maven 项目迁移到 gradle。我在变量springVersion中为所有项目指定 spring 版本。但是由于某种原因,在一个特定的依赖项 org.springframework:spring-web:springVersion上构建失败。当我直接输入版本org.springframework:spring-web:3.1.2.RELEASE 时,一切都会编译。这是我的 build.gradle 文件:
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
ext {
springVersion = "3.1.2.RELEASE"
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework:spring-context:springVersion'
compile 'org.springframework:spring-web:springVersion'
compile 'org.springframework:spring-core:springVersion'
compile 'org.springframework:spring-beans:springVersion'
testCompile 'org.springframework:spring-test:3.1.2.RELEASE'
testCompile 'org.slf4j:slf4j-log4j12:1.6.6'
testCompile 'junit:junit:4.10'
}
version = '1.0'
jar {
manifest.attributes provider: 'gradle'
}
}
错误信息:
* What went wrong:
Could not resolve all dependencies for configuration ':hi-db:compile'.
> Could not find group:org.springframework, module:spring-web, version:springVersion.
Required by:
hedgehog-investigator-project:hi-db:1.0
执行测试时 org.springframework:spring-test:3.1.2.RELEASE 也是如此。
是什么导致了他的问题以及如何解决?