以下是我在练习中使用的一个 Spring-Boot 的 build.gradle 文件,通过网络上搜索得到的一个比较全面的配置。
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}
}
buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
jacksonVersion = '2.8.5'
}
repositories {
// NOTE: You should declare only repositories that you need here
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
group 'com.liwei'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'spring-boot'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: "${jacksonVersion}"
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jacksonVersion}"
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: "${jacksonVersion}"
compile group: 'org.hashids', name: 'hashids', version: '1.0.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: "${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.14'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'com.google.guava', name: 'guava', version: '21.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.7'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.41'
}