小编kam*_*661的帖子

使用变量指定依赖项版本时构建失败

我正在尝试将我的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'
    }
}
Run Code Online (Sandbox Code Playgroud)

错误信息:

* 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
Run Code Online (Sandbox Code Playgroud)

与org.springframework相同:spring-test:3.1.2.RELEASE执行测试时.

什么导致他的问题以及如何解决?

java gradle

8
推荐指数
1
解决办法
5584
查看次数

标签 统计

gradle ×1

java ×1