SpringCloud第一步:gradle构建多模块项目

http://pmkiu.woguheihuasheng.cn/3578174
实现目标:

  • 一个父工程,里面有一些依赖
  • 子模块可以使用父模块的依赖
  • 子模块之间可以互相调用

在这里插入图片描述在这里插入图片描述

buildscript {
    ext{
        springbootVersion='2.2.6.RELEASE'
    }
    repositories {
       mavenCentral()
    }
    dependencies {
      classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootVersion}")
    }
}
allprojects {
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'java-library'
    group = 'com.example'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    configurations {
        developmentOnly
        runtimeClasspath {
            extendsFrom developmentOnly
        }
        compileOnly {
            extendsFrom annotationProcessor
        }
    }
}

subprojects {
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    [compileJava, compileTestJava, javadoc]*.options*.encoding = 'GBK'
    repositories {
        mavenCentral()
    }
    dependencies{
        compileOnly 'org.projectlombok:lombok'
        developmentOnly 'org.springframework.boot:spring-boot-devtools'
        annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
        annotationProcessor 'org.projectlombok:lombok'
        implementation 'org.springframework.boot:spring-boot-starter'
        testImplementation('org.springframework.boot:spring-boot-starter-test') {
            exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
        }
    }
}



版权声明:本文为weixin_44075369原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。