buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
group = 'com.springcloud'
version = '0.0.1-SNAPSHOT'
// JVM 版本号要求
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
// 显示当前项目下所有用于 compile 的 jar.
task listJars(description: 'Display all compile jars.') << {
configurations.compile.each { File file -> println file.name }
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
// java编译的时候缺省状态下会因为中文字符而失败
// [compileJava,compileTestJava,javadoc]*.options*.encoding = 'UTF-8'
//定义版本号
ext {
springCloudVersion = 'Dalston.SR1'
}
/*configurations {
// 所有需要忽略的包定义在此
all*.exclude group: 'commons-httpclient'
all*.exclude group: 'commons-logging'
all*.exclude group: 'commons-beanutils', module: 'commons-beanutils'
}*/
dependencies {
// 通用依赖
/* compile(
"org.springframework:spring-context:$springVersion"
)*/
// 依赖maven中不存在的jar
// ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
// ext.rootProjectLibs = new File(rootProject.rootDir, 'libs').getAbsolutePath()
// ext.jarTree += fileTree(dir: rootProjectLibs, include: '**/*.jar')
//
// compile jarTree
// 测试依赖
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
}
网友评论