1 Star 0 Fork 90

王宇强/h-cloud

forked from pangui/cloud 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 11.34 KB
一键复制 编辑 原始数据 按行查看 历史
何攀贵 提交于 2019-03-12 10:21 . 更新项目结构
buildscript {
ext {
springBootVersion = '2.1.3.RELEASE'
springCloudVersion = 'Greenwich.RELEASE'
}
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE")
classpath "gradle.plugin.org.zeroturnaround:gradle-jrebel-plugin:1.1.8"
classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE"
}
}
subprojects {
if ( name.equals('hcloud-components') || name.equals('hcloud-modules')
|| name.equals('hcloud-modules:hcloud-system') || name.equals('hcloud-modules:hcloud-auth') || name.equals('hcloud-modules:hcloud-common')) {
// 父级文件夹不进行构建
return;
}
group = "com.hcloud"
version = 1.0
apply plugin: "java"
apply plugin: 'idea'
// apply plugin: "org.zeroturnaround.gradle.jrebel"
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
repositories {
mavenLocal()
maven { url 'https://repo.spring.io/libs-milestone' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
jcenter()
}
ext {
springBootVersion = '2.1.3.RELEASE'
springCloudVersion = 'Greenwich.RELEASE'
oauth = '2.3.5.RELEASE'
lombok = '1.16.18'
jasypt = '2.1.0'
fastjson = '1.2.6'
mysql = '5.1.43'
log4j = '1.2.17'
durid = '1.1.12'
httpclient = '4.3.4'
poi = '3.9'
fastjson = '1.2.6'
hutool = '4.1.13'
monitor = '2.1.1'
}
// imports的mavenBom非常重要,它帮我们管理了springCloud各种零散的jar包的版本。有了它,
// 我们在对springCloud组件的依赖引入时,不需要指定具体的组件版本了,这简直是炒鸡方便啊。
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
[compileJava, compileTestJava, javadoc]*.options*.encoding = "UTF-8"
gradle.projectsEvaluated {
//消除“某些输入文件使用了未经检查或不安全的操作”的错误与警告
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
configurations {
//编译期排除commons模块
// compile.exclude module: 'spring-boot-starter-logging'
all*.exclude module: 'spring-boot-starter-tomcat'
// all*.exclude group: 'pkaq.tiger', module: 'share'
}
// plugins.withId('java') {
// project.apply plugin: 'org.zeroturnaround.gradle.jrebel'
// def jarTask = project.tasks.findByName('jar')
// if (jarTask) {
// jarTask.dependsOn(generateRebel)
// }
// def warTask = project.tasks.findByName('war')
// if (warTask) {
// warTask.dependsOn(generateRebel)
// }
// }
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.2'
//jdk11 移除了javaee的内容,需要手动引入
compile("javax.xml.bind:jaxb-api:2.3.0")
compile("com.sun.xml.bind:jaxb-core:2.3.0")
compile("com.sun.xml.bind:jaxb-impl:2.3.0")
compile("javax.activation:activation:1.1.1")
compileOnly("org.projectlombok:lombok:${lombok}")
compile("com.alibaba:fastjson:${fastjson}")
compile("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
compile("de.codecentric:spring-boot-admin-starter-client:${monitor}")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.cloud:spring-cloud-starter-config")
compile("com.github.ulisesbocchio:jasypt-spring-boot-starter:${jasypt}")
//除了网关之外的其他服务,统一只用undertow
if (!name.contains("gateway") && !name.contains("hcloud-common-redis")) {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-undertow")
}
// if(!name.contains("hcloud-components") && !name.contains("hcloud-common-core")){
// compile(project(":hcloud-common:hcloud-common-core"))
// }
//远程接口客户端,增加feign依赖
if (name.contains("-api")) {
compile("org.springframework.cloud:spring-cloud-starter-openfeign")
compile("io.github.openfeign:feign-httpclient")
compile("org.springframework.cloud:spring-cloud-starter-netflix-hystrix")
}
if (name.contains("-web")) {
compile(project(":hcloud-common:hcloud-common-curd"))
}
//非网关项目添加安全性依赖
if (!name.equals("hcloud-gateway") && !name.equals("hcloud-config")
&& !name.contains("hcloud-common-redis")) {
compile("org.springframework.cloud:spring-cloud-starter-security")
compile("org.springframework.security.oauth:spring-security-oauth2:${oauth}")
}
}
jar {
enabled = true
}
if ( name.contains("api") || name.contains("common") || name.contains("core")) {
} else {
task copyJars(type: Copy) {
from configurations.compile
into 'build/libs/lib'
}
task buildJar(type: Jar, dependsOn: [copyJars, jar]) {
manifest {
attributes(
'Created-By': 'hepg',
)
}
into('') {
from "$buildDir/classes/java/main"
}
into('') {
from "$buildDir/resources/main"
}
}
}
}
/**
* 务必按照被依赖的先后顺序编写project,否则runnalbeJar的task会报
* Cannot change dependencies of configuration after it has been included in dependency resolution
*/
project(":hcloud-common:hcloud-common-redis") {
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-redis")
}
}
project(":hcloud-common:hcloud-common-social") {
dependencies {
compile(project(":hcloud-common:hcloud-common-redis"))
}
}
project(":hcloud-common:hcloud-common-sms") {
dependencies {
compile(project(":hcloud-common:hcloud-common-redis"))
}
}
project(":hcloud-modules:hcloud-system:hcloud-system-api") {
dependencies {
compile(project(":hcloud-common:hcloud-common-core"))
}
}
project(":hcloud-common:hcloud-common-auth") {
dependencies {
compile(project(":hcloud-common:hcloud-common-core"))
compile("org.springframework.boot:spring-boot-starter-data-redis")
}
}
project(":hcloud-modules:hcloud-audit:hcloud-audit-api") {
dependencies {
compile(project(":hcloud-common:hcloud-common-core"))
compile(project(":hcloud-common:hcloud-common-auth"))
}
}
project(":hcloud-common:hcloud-common-curd") {
dependencies {
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("mysql:mysql-connector-java:${mysql}")
compile("com.alibaba:druid:${durid}")
compile("log4j:log4j:${log4j}")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
//jdk11下hibernate需要
compile("org.glassfish.jaxb:jaxb-runtime:2.3.0.1")
compile(project(":hcloud-common:hcloud-common-core"))
compile(project(":hcloud-common:hcloud-common-auth"))
}
}
project(":hcloud-components:hcloud-eureka") {
dependencies {
compile("org.springframework.cloud:spring-cloud-starter-netflix-eureka-server")
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.eureka.HCloudEurekaApplication',
'Class-Path': configurations.runtime.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-components:hcloud-config") {
dependencies {
compile("org.springframework.cloud:spring-cloud-config-server")
compile("org.springframework.cloud:spring-cloud-starter-netflix-hystrix")
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.HCloudConfigApplication',
'Class-Path': configurations.runtime.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-components:hcloud-gateway") {
dependencies {
compile("org.springframework.cloud:spring-cloud-starter-gateway")
compile("org.springframework.cloud:spring-cloud-starter-netflix-hystrix")
compile("com.github.whvcse:EasyCaptcha:1.5.0")
compile(project(":hcloud-common:hcloud-common-redis"))
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.HCloudGatewayApplication',
'Class-Path': configurations.compile.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-components:hcloud-monitor") {
dependencies {
compile("de.codecentric:spring-boot-admin-starter-server:${monitor}")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-undertow")
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.monitor.HCloudMonitorApplication',
'Class-Path': configurations.runtime.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-modules:hcloud-system:hcloud-system-web") {
dependencies {
compile(project(":hcloud-common:hcloud-common-social"))
compile(project(":hcloud-modules:hcloud-audit:hcloud-audit-api"))
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.HCloudSystemApplication',
'Class-Path': configurations.compile.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-modules:hcloud-audit:hcloud-audit-web") {
dependencies {
compile(project(":hcloud-common:hcloud-common-auth"))
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.HCloudAuditApplication',
'Class-Path': configurations.compile.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
project(":hcloud-modules:hcloud-auth:hcloud-auth-web") {
dependencies {
compile(project(":hcloud-common:hcloud-common-core"))
compile(project(":hcloud-common:hcloud-common-redis"))
compile(project(":hcloud-common:hcloud-common-auth"))
compile(project(":hcloud-modules:hcloud-audit:hcloud-audit-api"))
compile(project(":hcloud-modules:hcloud-system:hcloud-system-api"))
compile(project(":hcloud-common:hcloud-common-sms"))
compile(project(":hcloud-common:hcloud-common-social"))
compile("eu.bitwalker:UserAgentUtils:1.21")
}
buildJar {
manifest {
attributes(
'Main-Class': 'com.hcloud.HCloudAuthApplication',
'Class-Path': configurations.runtime.collect { 'lib/' + it.getName() }.join(' ')
)
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/wyq3360/h-cloud.git
git@gitee.com:wyq3360/h-cloud.git
wyq3360
h-cloud
h-cloud
bak

搜索帮助

D67c1975 1850385 1daf7b77 1850385