Skip to content

Commit

Permalink
Merge pull request #55 from DDD-Community/refactor/mono-repo
Browse files Browse the repository at this point in the history
�스프링 멀티 모듈 구성
  • Loading branch information
aihoshistar authored Mar 13, 2024
2 parents 209fb07 + 6fdb9af commit 40a0aa7
Show file tree
Hide file tree
Showing 140 changed files with 2,229 additions and 618 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ out/
data/

/src/main/generated/
/src/querydsl/
/src/querydsl/

.DS_Store
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions Dockerfile.jenkins

This file was deleted.

63 changes: 0 additions & 63 deletions Jenkinsfile

This file was deleted.

164 changes: 32 additions & 132 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,146 +1,46 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'com.google.cloud.tools.jib' version '3.4.0'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group = 'com.wable'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
buildscript {
ext {
springBootVersion = '3.2.3'
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
}
}

repositories {
mavenCentral()
}

ext {
set('snippetsDir', file("build/generated-snippets"))
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
// for cognito
implementation platform('software.amazon.awssdk:bom:2.20.56')
implementation 'software.amazon.awssdk:s3'
// NOTE: Is Not Working
// implementation 'org.springdoc:springdoc-openapi-ui:1.6.15'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'org.springframework.security:spring-security-config:6.0.2'

// 이거 쓰니까 스웨거 되더라구요
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'

// aws s3
implementation 'software.amazon.awssdk:s3:2.17.285'

// jpa query logging
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'

// Querydsl 추가
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'
annotationProcessor 'jakarta.annotation:jakarta.annotation-api'
annotationProcessor 'jakarta.persistence:jakarta.persistence-api'

// spring security
implementation 'org.springframework.boot:spring-boot-starter-security'
// 하위 모든 프로젝트 공통 세팅
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

// cognito
implementation 'software.amazon.awssdk:cognitoidentityprovider:2.20.66'
group 'org.wable'
version '1.0-SNAPSHOT'

implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5'

implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'

}

// tasks.named('test') {
// outputs.dir snippetsDir
// useJUnitPlatform()
// }

tasks.named('asciidoctor') {
inputs.dir snippetsDir
dependsOn test
}
sourceCompatibility = '17'
targetCompatibility = '17'
compileJava.options.encoding = 'UTF-8'

jib {
from {
image = 'eclipse-temurin:17-jdk-focal'
repositories {
mavenCentral()
}
to {
image = 'ghcr.io/ddd-community/ddd-10-wable-server:main'
}
container {
entrypoint = ['java', '-Dspring.profiles.active=dev', '-jar', 'harmonika-0.0.1-SNAPSHOT.jar']

jvmFlags = ['-Xms512m', '-Xmx512m', '-Xdebug', '-XshowSettings:vm', '-XX:+UnlockExperimentalVMOptions', '-XX:+UseContainerSupport']
ports = ['8080']
// 하위 모듈에서 공통으로 사용하는 세팅 추가
dependencies {
compileOnly 'org.projectlombok:lombok'

environment = [
SPRING_OUTPUT_ANSI_ENABLED: "ALWAYS",
ENCRYPTOR_PASSWORD: System.getenv("ENCRYPTOR_PASSWORD")
]
labels = [version:project.version, name:project.name, group:project.group]
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"

creationTime = 'USE_CURRENT_TIMESTAMP'
format = 'Docker'
}
extraDirectories {
paths {
path {
from = file('build/libs')
}
}
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}
}

// QueryDSL
def querydslDir = "$projectDir/src/main/generated"

querydsl {
jpa = true
querydslSourcesDir = querydslDir
}

sourceSets {
main.java.srcDir querydslDir
}

compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
// https://stackoverflow.com/questions/76248226/how-to-make-spring-boot-msa-with-querydsl
options.compilerArgs += ['-proc:none']
source = fileTree(querydslDir)
exclude(querydslDir + "/**/**")
}

configurations {
compileOnly {
extendsFrom annotationProcessor
test {
useJUnitPlatform()
}
querydsl.extendsFrom compileClasspath
}
37 changes: 37 additions & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
21 changes: 21 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


group = 'com.wable'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

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

tasks.named('test') {
useJUnitPlatform()
}
Binary file added core/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions core/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 40a0aa7

Please sign in to comment.