天天看點

gradle_學習_02_gradle多子產品建構執行個體

一、前言

二、多子產品建構

1.工程結構

gradle_學習_02_gradle多子產品建構執行個體

 父工程:weixin-service

子子產品:weixin-gz

               weixin-qy

2.父工程 weixin-service

(1)build.gradle

gradle_學習_02_gradle多子產品建構執行個體
gradle_學習_02_gradle多子產品建構執行個體
buildscript {
    ext {
        springBootVersion = '2.0.1.RELEASE'
    }
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        //mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

//配置所有項目
allprojects {
    //應用插件
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'

    //公共屬性
    group = 'com.ray.weixin'
    version = '0.0.1-SNAPSHOT'

    //編譯屬性
    sourceCompatibility = 1.8
    targetCompatibility = 1.8

}

//建構依賴
subprojects {

    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }

    dependencies {
        compile('org.springframework.boot:spring-boot-starter-thymeleaf')
        compile('org.springframework.boot:spring-boot-starter-validation')
        compile('org.springframework.boot:spring-boot-starter-web')
        compileOnly('org.projectlombok:lombok')

        // 5. jackson
        compile ('com.alibaba:fastjson:1.2.44')

        //6. Redis
        compile('org.springframework.boot:spring-boot-starter-data-redis')

        //7.Quartz
        compile('org.springframework.boot:spring-boot-starter-quartz')

        testCompile('org.springframework.boot:spring-boot-starter-test')
    }
}

repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}      

View Code

(2)settings.gradle

rootProject.name = 'weixin-service'
include 'weixin-gz'
include 'weixin-qy'      

3.子子產品 weixin-gz

dependencies {

}      

4.子子產品 weixin-qy

dependencies {

}      

三、參考資料

1.