123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- apply from: 'dependencyDefine.gradle'
- // SpringBoot
- buildscript {
- ext {
- springBootVersion = '2.1.3.RELEASE'
- // wrapperVersion = '1.0.21.RELEASE'
- }
- repositories {
- maven { url 'https://maven.aliyun.com/repository/public/' }
- maven { url 'https://maven.aliyun.com/repository/google/'}
- maven { url 'https://maven.aliyun.com/repository/jcenter/'}
- mavenLocal()
- mavenCentral()
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
- dependencies {
- // classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
- classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
- }
- }
- allprojects {
- repositories {
- //google()
- //jcenter()
- maven { url 'https://maven.aliyun.com/repository/public/' }
- maven { url 'https://maven.aliyun.com/repository/google/'}
- maven { url 'https://maven.aliyun.com/repository/jcenter/'}
- mavenLocal()
- mavenCentral()
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
- }
- subprojects {
- apply plugin: 'java'
- apply plugin: "idea"
- apply plugin: 'maven'
- // apply plugin: 'eclipse'
- apply plugin: 'org.springframework.boot'
- apply plugin: 'io.spring.dependency-management'
- group = 'com.qxgmat'
- version = '0.0.1-SNAPSHOT'
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
- }
- repositories {
- mavenLocal()
- maven { url = "http://maven.aliyun.com/nexus/content/groups/public" }
- mavenCentral()
- }
- configurations{
- parentClasspath {}
- }
- // 清除现有的lib目录
- task clearJar(type: Delete) {
- delete "$buildDir/libs/lib"
- }
- // 将依赖包复制到lib目录
- task copyJar(type: Copy, dependsOn: 'clearJar') {
- from configurations.compileClasspath
- into "$buildDir/libs/lib"
- }
- // 删除多余依赖
- task clearCom(type: Copy, dependsOn: 'copyJar') {
- delete "$buildDir/libs/lib/com"
- }
- dependencies {
- compileClasspath("org.springframework.boot:spring-boot-starter")
- compileClasspath("org.springframework.boot:spring-boot-starter-web")
- testCompile("org.springframework.boot:spring-boot-starter-web")
- compileClasspath('org.springframework.boot:spring-boot-starter-aop')
- testCompile('org.springframework.boot:spring-boot-starter-aop')
- compileClasspath('org.springframework.boot:spring-boot-starter-jdbc')
- testCompile('org.springframework.boot:spring-boot-starter-jdbc')
- compileClasspath('org.springframework.boot:spring-boot-starter-data-jpa')
- testCompile('org.springframework.boot:spring-boot-starter-data-jpa')
- // compileClasspath("org.springframework.boot:spring-boot-starter-security")
- // testCompile("org.springframework.boot:spring-boot-starter-security")
- compileClasspath("org.springframework.boot:spring-boot-starter-actuator")
- testCompile("org.springframework.boot:spring-boot-starter-actuator")
- compileClasspath('org.springframework.boot:spring-boot-starter-logging')
- testCompile('org.springframework.boot:spring-boot-starter-logging')
- compileClasspath('org.springframework.boot:spring-boot-starter-cache')
- testCompile('org.springframework.boot:spring-boot-starter-cache')
- compileClasspath('org.springframework.boot:spring-boot-starter-data-redis')
- testCompile('org.springframework.boot:spring-boot-starter-data-redis')
- compileClasspath("org.springframework.boot:spring-boot-devtools")
- testCompile("org.springframework.boot:spring-boot-devtools")
- compileClasspath('mysql:mysql-connector-java')
- testCompile('mysql:mysql-connector-java')
- compileClasspath(libraries."mybatis", libraries."mybatis-page")
- testCompile(libraries."mybatis", libraries."mybatis-page")
- compileClasspath("tk.mybatis:mapper-spring-boot-starter:2.1.5"){
- exclude group: "javax.persistence"
- }
- testCompile("tk.mybatis:mapper-spring-boot-starter:2.1.5"){
- exclude group: "javax.persistence"
- }
- testCompile("org.springframework.boot:spring-boot-starter-test")
- compileClasspath group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.9'
- testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.9'
- compileClasspath group: 'com.alibaba', name: 'fastjson', version: '1.2.46'
- testCompile group: 'com.alibaba', name: 'fastjson', version: '1.2.46'
- compileClasspath 'javax.persistence:javax.persistence-api:2.2'
- testCompile 'javax.persistence:javax.persistence-api:2.2'
- compileClasspath group: 'net.ipip', name: 'ipdb', version: '1.1.2'
- testCompile group: 'net.ipip', name: 'ipdb', version: '1.1.2'
- compileClasspath fileTree(dir:'libs',include:['*.jar'])
- testCompile fileTree(dir:'libs',include:['*.jar'])
- }
- //自定义环境 start
- def env = System.getProperty("ENV") ?: (System.getenv("ENV") ?: "dev")
- println(env)
- sourceSets {
- main {
- resources {
- srcDirs = ["src/main/resources", "src/main/profile/$env", "src/main/java"]
- }
- }
- test {
- resources {
- srcDirs = ["src/test/resources", "src/main/resources", "src/main/profile/$env", "src/main/java"]
- }
- }
- }
- //自定义环境 end
- }
- // 如果不使用spring boot plugin,也可以使用spring boot dependency management,只需要导入SpringBootPlugin类的BOM_COORDINATES常量
- //dependencyManagement {
- // imports {
- // mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
- // }
- //}
- //如果module中名称有包含api的,则加入下面的内容
- configure(subprojects.findAll {it.name.contains('api')}) {
- apply plugin: 'war'
- apply plugin: 'application'
- // apply plugin: 'org.springframework.boot.experimental.thin-launcher'
- springBoot {
- buildInfo()
- }
- // war {
- // manifest {
- // attributes("Implementation-Title": "Gradle")
- // }
- // }
- // task createPom {
- // doLast {
- // pom {
- // withXml(dependencyManagement.pomConfigurer)
- // }.writeTo("build/resources/main/META-INF/maven/${project.group}/${project.name}/pom.xml")
- // }
- // }
- //
- // thinResolvePrepare {
- // into new File("${buildDir}/thin/deploy")
- // }
- //
- // jar.dependsOn = [createPom]
- dependencies {
- // providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
- // providedRuntime 'org.springframework.boot:spring-boot-starter-jetty'
- }
- }
- project(':data') {
- dependencies {
- compile(project(":tools"))
- }
- }
- project(':gateway-api') {
- dependencies {
- compile(project(":tools"))
- compile(project(":data"))
- compileClasspath project(path:":tools", configuration: 'parentClasspath')
- compileClasspath project(path:":data", configuration: 'parentClasspath')
- testCompile(project(":tools"))
- testCompile(project(":data"))
- testCompile project(path:":tools", configuration: 'parentClasspath')
- testCompile project(path:":data", configuration: 'parentClasspath')
- }
- }
|