gradle微服务依赖模版

1、父工程依赖模版

注: ext里的内容需要配合设置云效仓库参数到环境变量及gradle使用-CSDN博客使用

Groovy 复制代码
plugins {  
	id 'org.springframework.boot' version '2.3.12.RELEASE'  
	// 引入dependency-management插件  
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}  
  
group = 'com.fafa'  
  
subprojects {  
	apply plugin: 'org.springframework.boot'  
	apply plugin: 'io.spring.dependency-management'  
	apply plugin: 'java'  
	  
	sourceCompatibility = 11  
	targetCompatibility = 11  
	  
	ext {  
		MAVEN_REPO_RELEASE_URL = System.getenv('MAVEN_REPO_RELEASE_URL')  
		MAVEN_REPO_SNAPSHOT_URL = System.getenv('MAVEN_REPO_SNAPSHOT_URL')  
		MAVEN_DEPLOY_USER = System.getenv('MAVEN_DEPLOY_USER')  
		MAVEN_DEPLOY_PASSWORD = System.getenv('MAVEN_DEPLOY_PASSWORD')  
	}  
	  
	repositories {  
		maven { url "https://maven.aliyun.com/nexus/content/groups/public/" }  
		maven {  
			url 'https://maven.aliyun.com/repository/public'  
		}  
		maven { url "https://repo.spring.io/milestone" }  
		maven { url "https://plugins.gradle.org/m2/" }  
		maven {  
			credentials {  
				username MAVEN_DEPLOY_USER  
				password MAVEN_DEPLOY_PASSWORD  
			}  
			url MAVEN_REPO_RELEASE_URL  
		}  
		maven {  
			credentials {  
				username MAVEN_DEPLOY_USER  
				password MAVEN_DEPLOY_PASSWORD  
			}  
			url MAVEN_REPO_SNAPSHOT_URL  
		}  
		mavenCentral()  
	}  
	  
	configurations{  
	// implementation {  
	// exclude group: 'com.alibaba.nacos', module: 'nacos-client'  
	// }  
	}  
	  
	dependencyManagement {  
		imports { mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:2.2.10-RC1" }  
		imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR12" }  
	}  
	  
	dependencies {  
		//Spring Boot Web 启动器  
		implementation 'org.springframework.boot:spring-boot-starter-web'  
		  
		compileOnly 'org.projectlombok:lombok'  
		runtimeOnly 'mysql:mysql-connector-java'  
		annotationProcessor 'org.projectlombok:lombok'  
		  
		testImplementation 'org.springframework.boot:spring-boot-starter-test'  
	}  
	  
	test {  
		useJUnitPlatform()  
	}  
	  
	sourceSets {  
		main {  
			resources {  
				srcDirs = ['src/main/resources']  
			}  
		}  
	}  
	  
	tasks.withType(JavaCompile) {  
		options.encoding = "UTF-8"  
		doLast {  
			copy {  
				from sourceSets.main.resources  
				into "$buildDir/resources/main"  
			}  
		}  
	}  
}

2、子工程依赖模版

Groovy 复制代码
group = 'com.fafa.order'  
version = '1.0'  
description = "order-service"  
  
apply plugin: 'application'  
  
dependencies {  
	//mybatis  
	implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1'  
}
相关推荐
wangjialelele19 小时前
一文梳理 Spring Cloud 核心组件:Eureka、Nacos、OpenFeign、LoadBalancer 与 Gateway
java·spring boot·spring·spring cloud·微服务·nacos
草莓熊Lotso21 小时前
【C++ 基于微服务的即时通讯系统】Elasticsearch 从安装到 C++ 客户端二次封装全落地
linux·网络·数据库·c++·elasticsearch·微服务
银河技术1 天前
从脚本到 Operator:用 Go 构建可靠的微服务自动扩缩容控制器
开发语言·微服务·golang
草莓熊Lotso1 天前
【C++ 基于微服务的即时通讯系统】etcd + brpc 从安装到服务注册发现全链路实战
网络·数据库·c++·redis·微服务·etcd
我不会起名字3222 天前
微服务链路超时怎么设:逐层收敛的 4 条规则与 1 个反例
微服务·go·超时·熔断
Wang's Blog2 天前
Java 项目实战: 交友项目 - 章节复盘:微服务骨架与手机号验证码登录
java·微服务·交友
我不会起名字3222 天前
负载均衡选错:轮询在长连接下的偏斜问题
微服务·负载均衡·grpc·长连接
code_slave(码畜)3 天前
微服务架构落地:OpenFeign 服务远程调用 + 线程池隔离架构实战 —— 超时控制、重试机制、线程池隔离,防雪崩
spring boot·spring cloud·微服务·云原生·架构·openfeign
涵美女程序猿3 天前
ChatCut online 剪微服务熔断测试录屏:仪表盘告警、降级日志与恢复时刻怎样对应
程序人生·微服务·云原生·架构·电脑
hhb_6183 天前
智联AI办公微服务技术全解析
人工智能·微服务·架构