Skip to content

Commit

Permalink
feat($auth-center): successfully migrate to Gradle 7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Jul 31, 2022
1 parent 9382504 commit b4236cf
Show file tree
Hide file tree
Showing 78 changed files with 240 additions and 1,070 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ build/
*.code-workspace
# Local History for Visual Studio Code
.history/

### Gradle template
.gradle
**/build/
**/out/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

Binary file not shown.
Empty file.
Binary file removed .gradle/7.0.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file removed .gradle/7.0.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/7.0.2/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/7.0.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/7.0.2/fileHashes/fileHashes.lock
Binary file not shown.
Empty file removed .gradle/7.0.2/gc.properties
Empty file.
Binary file not shown.
Empty file.
Binary file removed .gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file removed .gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/7.2/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Empty file removed .gradle/7.2/gc.properties
Empty file.
Binary file removed .gradle/7.5/checksums/checksums.lock
Binary file not shown.
Binary file removed .gradle/7.5/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed .gradle/7.5/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Empty file.
Binary file removed .gradle/7.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/7.5/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/7.5/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/7.5/fileHashes/fileHashes.lock
Binary file not shown.
Empty file removed .gradle/7.5/gc.properties
Empty file.
Binary file removed .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 0 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties

This file was deleted.

Binary file removed .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file removed .gradle/checksums/checksums.lock
Binary file not shown.
Binary file removed .gradle/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed .gradle/checksums/sha1-checksums.bin
Binary file not shown.
Binary file removed .gradle/file-system.probe
Binary file not shown.
Empty file removed .gradle/vcs-1/gc.properties
Empty file.
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-biz/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*/

dependencies {
implementation(project(":reactive-spring-cloud-starter"))
implementation("org.springframework.cloud:spring-cloud-starter-gateway")
Expand Down
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*/

dependencies {
implementation(project(":api-gateway-web"))
implementation(project(":api-gateway-message"))
Expand Down
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*/

dependencies {
implementation(project(":api-gateway-infra"))
}
Expand Down
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-infra/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/*
* This file was generated by the Gradle 'init' task.
*/

description = "Muscle and Fitness Server :: API Gateway - Infra"
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-message/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*/

dependencies {
implementation(project(":api-gateway-biz"))
}
Expand Down
4 changes: 0 additions & 4 deletions api-gateway/api-gateway-web/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*/

dependencies {
implementation(project(":api-gateway-biz"))
}
Expand Down
41 changes: 1 addition & 40 deletions auth-center/auth-center-biz/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,5 @@ description = "Muscle and Fitness Server :: Auth Center - Biz"

dependencies {
// MAF dependencies
implementation(project(":spring-cloud-starter"))
implementation(project(":universal-ui"))

// Spring Dependencies
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.springframework.boot:spring-boot-starter-data-elasticsearch")
implementation("org.springframework.boot:spring-boot-starter-amqp")
implementation("org.springframework.boot:spring-boot-starter-quartz")
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("org.springframework.boot:spring-boot-starter-reactor-netty")
implementation("org.springframework:spring-test")

// Spring Integration
implementation("org.springframework.integration:spring-integration-redis")

// ORM Libraries
// runtimeOnly libraries are the opposite, they are available at runtime but not at compile-time.
runtimeOnly("mysql:mysql-connector-java")
val mybatisPlusBootStarterVersion: String by project
implementation("com.baomidou:mybatis-plus-boot-starter:$mybatisPlusBootStarterVersion")
val shardingsphereVersion: String by project
implementation("org.apache.shardingsphere:shardingsphere-jdbc-core-spring-boot-starter:$shardingsphereVersion")

// JWT, https://github.com/jwtk/jjwt
// Cannot Remove jjwt dependencies, cuz the login process is in here `auth-center`, and the auth process is in `api-gateway`
val jjwtVersion: String by project
implementation("io.jsonwebtoken:jjwt-api:$jjwtVersion")
runtimeOnly("io.jsonwebtoken:jjwt-impl:$jjwtVersion")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:$jjwtVersion")

// Apache POI - Java API To Access Microsoft Format Files
val poiVersion: String by project
runtimeOnly("org.apache.poi:poi:$poiVersion")
runtimeOnly("org.apache.poi:poi-ooxml:$poiVersion")

// Testing
testImplementation("org.springframework.amqp:spring-rabbit-test")
testImplementation("org.mockito:mockito-inline")

implementation(project(":auth-center-domain"))
api(project(":auth-center-domain"))
}
22 changes: 0 additions & 22 deletions auth-center/auth-center-biz/pom.xml

This file was deleted.

80 changes: 30 additions & 50 deletions auth-center/auth-center-bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,59 +1,39 @@
@file:Suppress("UnstableApiUsage")

import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.run.BootRun

description = "Muscle and Fitness Server :: Auth Center - Bootstrap"

val projectGroupId: String by project
group = projectGroupId
val projectVersion: String by project
version = projectVersion
tasks.withType<BootJar> {
this.enabled = true
}

springBoot {
buildInfo()
}

tasks.withType<BootRun> {
if (project.hasProperty("jvmArgs")) {
val jvmArgsProperty = (project.properties["jvmArgs"] as String)
logger.info("jvmArgsProperty for the app [${project.name}] (before split): `$jvmArgsProperty`")
jvmArgs = jvmArgsProperty.split(Regex("\\s+"))
logger.info("allJvmArgs for the app [${project.name}] (after split): $allJvmArgs")
}
}

plugins {
kotlin("jvm")
kotlin("plugin.spring")
id("org.springframework.boot") apply true
// https://www.baeldung.com/spring-boot-auto-property-expansion
// https://github.com/gradle/kotlin-dsl-samples/blob/master/samples/copy/build.gradle.kts
// https://www.tristanfarmer.dev/blog/gradle_property_expansion_spring_boot
tasks.withType<ProcessResources> {
// Only expand the file `application.yml`
filesMatching("**/application.yml") {
expand(project.properties)
}
}

dependencies {
// MAF dependencies
implementation(project(":spring-cloud-starter"))
implementation(project(":universal-ui"))
// MAF dependencies, and the dependencies in `bootstrap` have no need to be transitive
implementation(project(":auth-center-web"))
implementation(project(":auth-center-message"))

// Spring Dependencies
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.springframework.boot:spring-boot-starter-data-elasticsearch")
implementation("org.springframework.boot:spring-boot-starter-amqp")
implementation("org.springframework.boot:spring-boot-starter-quartz")
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("org.springframework.boot:spring-boot-starter-reactor-netty")
implementation("org.springframework:spring-test")

// Spring Integration
implementation("org.springframework.integration:spring-integration-redis")

// ORM Libraries
// runtimeOnly libraries are the opposite, they are available at runtime but not at compile-time.
runtimeOnly("mysql:mysql-connector-java")
val mybatisPlusBootStarterVersion: String by project
implementation("com.baomidou:mybatis-plus-boot-starter:$mybatisPlusBootStarterVersion")
val shardingsphereVersion: String by project
implementation("org.apache.shardingsphere:shardingsphere-jdbc-core-spring-boot-starter:$shardingsphereVersion")

// JWT, https://github.com/jwtk/jjwt
// Cannot Remove jjwt dependencies, cuz the login process is in here `auth-center`, and the auth process is in `api-gateway`
val jjwtVersion: String by project
implementation("io.jsonwebtoken:jjwt-api:$jjwtVersion")
runtimeOnly("io.jsonwebtoken:jjwt-impl:$jjwtVersion")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:$jjwtVersion")

// Apache POI - Java API To Access Microsoft Format Files
val poiVersion: String by project
runtimeOnly("org.apache.poi:poi:$poiVersion")
runtimeOnly("org.apache.poi:poi-ooxml:$poiVersion")


// Testing
testImplementation("org.springframework.amqp:spring-rabbit-test")
testImplementation("org.mockito:mockito-inline")

implementation(project(":auth-center-domain"))
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
server:
port: @auth-center.port@
port: ${authCenterPort}
tomcat:
uri-encoding: @project.build.sourceEncoding@
uri-encoding: ${projectBuildSourceEncoding}
shutdown: GRACEFUL
servlet:
context-path:

spring:
application:
name: @project.parent.artifactId@
name: ${authCenterArtifactId}
profiles:
active: @environment@
active: ${environment}
config:
import: consul:${spring.cloud.consul.host}:${spring.cloud.consul.port}
import: consul:\${spring.cloud.consul.host}:\${spring.cloud.consul.port}
cloud:
# https://docs.spring.io/spring-cloud-consul/docs/current/reference/html/index.html#spring-cloud-consul-config
consul:
Expand All @@ -32,44 +32,44 @@ spring:
- shardingsphere
discovery:
register: true
instance-id: ${spring.application.name}-${spring.cloud.client.hostname}-${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
service-name: ${spring.application.name}
port: ${server.port}
instance-id: \${spring.application.name}-\${spring.cloud.client.hostname}-\${vcap.application.instance_id:\${spring.application.instance_id:\${random.value}}}
service-name: \${spring.application.name}
port: \${server.port}
prefer-ip-address: true
ip-address: ${spring.cloud.client.ip-address}
ip-address: \${spring.cloud.client.ip-address}
health-check-critical-timeout: 15s
servlet:
multipart:
location: @project.parent.artifactId@/${spring.application.name}/temprary-file
location: ${projectArtifactId}/\${spring.application.name}/temporary-file
max-file-size: 64MB
max-request-size: 70MB
file-size-threshold: 0

logging:
config: classpath:logback-configuration/logback-${spring.profiles.active}.xml
config: classpath:logback-configuration/logback-\${spring.profiles.active}.xml
level:
org.springframework.data.elasticsearch.client.WIRE: DEBUG

maf:
project-properties:
base-package: @project.groupId@
context-path: ${server.servlet.context-path}
group-id: @project.groupId@
project-parent-artifact-id: @project.parent.artifactId@
project-artifact-id: @project.parent.artifactId@
version: @project.version@
description: @project.description@
jdk-version: @java.version@
environment: ${spring.profiles.active}
url: @project.url@
inception-year: @inceptionYear@
organization-name: @project.organization.name@
organization-url: @project.organization.url@
issue-management-system: @project.issueManagement.system@
issue-management-url: @project.issueManagement.url@
developer-name: @developerName@
developer-email: @developerEmail@
developer-url: @developerUrl@
base-package: ${projectGroupId}
context-path: \${server.servlet.context-path}
group-id: ${projectGroupId}
project-parent-artifact-id: ${projectArtifactId}
project-artifact-id: ${authCenterArtifactId}
version: ${projectVersion}
description: "${description}"
jdk-version: ${javaVersion}
environment: \${spring.profiles.active}
url: ${projectUrl}
inception-year: ${inceptionYear}
organization-name: ${projectOrganizationName}
organization-url: ${projectOrganizationUrl}
issue-management-system: ${projectIssueManagementSystem}
issue-management-url: ${projectIssueManagementUrl}
developer-name: ${developerName}
developer-email: ${developerEmail}
developer-url: ${developerUrl}
configuration:
ignored-url:
pattern:
Expand All @@ -81,7 +81,7 @@ maf:
- "/*/v2/api-docs/**"
- "/webjars/**"
- "/doc.html"
included-package-for-http-api-scan: ${maf.project-properties.base-package}
included-package-for-http-api-scan: \${maf.project-properties.base-package}
jwt:
# an hour
ttl: 3600000
Loading

0 comments on commit b4236cf

Please sign in to comment.