简体   繁体   中英

Cannot add Spring dependencies with Gradle

I am new to Spring, and I am trying to create a simple Spring Boot "hello world" application, so I created a build.gradle file to add Spring Boot dependency:

apply plugin: 'java'

repositories {
    jcenter()
}

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

The problem is that it does not add the required jar(s), so I cannot use Spring annotations, such as @Controller .

What am I missing to make it work?

I am using IntelliJ Idea 2016.1, if this can help.

This would help you :

http://start.spring.io/

just setup your dep and this include them all as a starter kit :) Enjoy

    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")
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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