繁体   English   中英

无法使用Gradle添加Spring依赖项

[英]Cannot add Spring dependencies with Gradle

我是Spring的新手,我试图创建一个简单的Spring Boot“ hello world”应用程序,因此我创建了一个build.gradle文件来添加Spring Boot依赖项:

apply plugin: 'java'

repositories {
    jcenter()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE")
}

问题是它没有添加所需的jar,所以我不能使用Spring注释,例如@Controller

我想让它起作用吗?

如果有帮助,我正在使用IntelliJ Idea 2016.1。

这将帮助您:

http://start.spring.io/

只需设置您的部门,并将它们作为入门工具包包括在内即可:)

    buildscript {
        repositories {
             mavenLocal()
             jcenter()
        }
        dependencies {
            classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '1.3.3.RELEASE'
        }
    }

    apply plugin: 'java'

    repositories {
        jcenter()
    }

    dependencies {
        compile("org.springframework.boot:spring-boot-starter-web")
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM