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