[英]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。
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.