idea 修改 setting-gradel
build.gradel文件配置
// buildscript必须在顶部,注意位置
buildscript {
repositories {
// 优先使用国内源
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
dependencies {
// 让spring-boot支持gradle
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.1.RELEASE")
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.1.1.RELEASE'
}
apply plugin: 'java'
apply plugin: 'idea'
// 使用spring boot
apply plugin: "org.springframework.boot"
// 使用spring boot的自动依赖管理
apply plugin: 'io.spring.dependency-management'
group 'com.genew.nuas'
version '1.0-SNAPSHOT'
//指定java版本
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
// 使用国内的源
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
//依赖列表
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
加上spring boot 就可以启动一个简单的spring boot的项目了