Gradle Spring Boot - 弹簧罐版本不会自动拾取

时间:2017-06-13 08:05:49

标签: gradle spring-boot gradle-plugin spring-boot-gradle-plugin

我正在尝试一个简单的gradle spring boot应用程序,如下面的URL

https://spring.io/guides/gs/spring-boot/

这是我的build.gradle文件

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'my-jar'
    version =  '1.0.0'
}


dependencies {

    compile "org.springframework.boot:spring-boot-starter-web"
    testCompile "junit:junit"
}

我正在使用本地神器,我的init.gradle具有在

下面的buildscript配置
buildscript {
        repositories {

                maven {
                url 'http://mylocalartifactory:8081/'
                }

        }

        dependencies {  classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE" }
    }

当我尝试运行gradlew build

时出现以下错误
What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-web:.

看起来版本没有应用于依赖项。 据我所知,版本将由spring-boot插件默认。

我错过了什么吗?

如果我在依赖项中提及版本号

,它可以正常工作
dependencies {

    compile "org.springframework.boot:spring-boot-starter-web:1.5.2.RELEASE"
    testCompile "junit:junit"
}

虽然我可以使它工作,但是如果我需要手动指定spring版本的jar依赖项,它会胜过使用spring boot的目的。

如果您在我的build.gradle或init.gradle

中发现任何问题,请退回

0 个答案:

没有答案