第1部分:Spring&Gradle-多模块项目

概述:

在本文中,我们将实现Spring Boot多模块应用程序。 我们将使用gradle构建系统。 目的是创建一个微服务应用程序,该应用程序将在以后的文章中介绍。

布局:

在这里,我们将使用平面布局将应用程序目录保留为根项目目录(Pic-1)的兄弟。 平面布局的优点是我们可以为每个应用程序使用不同的git存储库。 在您的根项目的settings.gradle文件中,我们需要在子项目中使用includeFlat。

Alt Text
Pic-1. Directory Structure

项目:根

该项目只有项目配置文件,例如build.gradle和settings.gradle。

settings.gradle:

rootProject.name = 'root'

includeFlat 'utilities', 'exception-handler’, 'discovery-server'
includeFlat 'enquiry', 'api-gateway', 'registration'

build.gradle:

buildscript {

 ext {
  springBootVersion = '2.1.6.RELEASE' 
 }

repositories {
 mavenCentral()
}

dependencies {
 classpath("org.springframework.boot:spring-boot-gradle- plugin:${springBootVersion}")
 }
}

subprojects {

 apply plugin: 'java'
 apply plugin: 'org.springframework.boot'
 apply plugin: 'io.spring.dependency-management'

 group = 'com.apandiyan'
 version = '0.0.1'
 sourceCompatibility = '1.8'
 repositories {
  mavenCentral()
 }

 ext {
  set('springCloudVersion', "Greenwich.SR1")
 }

 dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-web'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
 }

 dependencyManagement {
  imports {
   mavenBom "org.springframework.cloud:spring-cloud- dependencies:${springCloudVersion}"
  }
 }
}

Source: https://github.com/pandiyan90/microservice-blog/tree/master/root

from: https://dev.to//pandiyan90/part-1-spring-gradle-multi-module-project-1j8a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值