buildscript { //buildscript代码块中脚本优先执行 //ext用于定义动态属性 ext { springBootVersion = '2.0.0.M2.RELEASE' // 自定义 Thymeleaf 和 Thymeleaf Layout Dialect 的版本 ext['thymeleaf.version'] = '3.0.6.RELEASE' ext['thymeleaf-layout-dialect.version'] = '2.2.2' } //使用了maven的中央仓库(也能够指定其余仓库) repositories { mavenCentral() maven {url "https://repo.spring.io/snapshot"} maven {url "https://repo.spring.io/milestone"} maven {url "http://maven.aliyun.com/nexus/content/groups/public/"} } //依赖关系 dependencies { //classpath 声明说明了在执行其他脚本时,calsspath可使用这些依赖项 classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } //使用插件 apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' group = 'com.nilwu.spring.boot.blog' //指定了生成的编译文件的版本,默认是打成了jar包 version = '0.0.1-SNAPSHOT' //指定了编译.java 文件的JDK版本 sourceCompatibility = 1.8 //使用了maven的中央仓库(也能够指定其余仓库) repositories { mavenCentral() maven {url "https://repo.spring.io/snapshot"} maven {url "https://repo.spring.io/milestone"} maven {url "http://maven.aliyun.com/nexus/content/groups/public/"} } //依赖关系 dependencies { compile('org.springframework.boot:spring-boot-starter-web') testCompile('org.springframework.boot:spring-boot-starter-test') compile('org.springframework.boot:spring-boot-starter-thymeleaf') }