1.build.gradle: 重点是 dependencies 部分。
修改后右键工程-->gradle-->Refresh All
首次编译下载jar包,比较慢;如果失败重新执行Refresh All。
buildscript {
repositories {
maven { url "https://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.RELEASE")
}
}
apply plugin: 'war'
apply plugin: 'eclipse'
//apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'bpo-pos-web'
version = '0.1.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/libs-release" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-tomcat")
compile("org.apache.tomcat.embed:tomcat-embed-jasper")
compile("javax.servlet:jstl")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
2.java 包结构