簡體   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