개인프로젝트/기능프로그램_오늘뭐입지

20240505_멀티 모듈

일일일코_장민기 2024. 5. 5. 00:12
728x90

 

1. 우선 프로젝트 생성(msa)

- jdk 17

- gradle

 

2. 모듈 생성

- core: 공통 모듈

- member: 유저 로그인 / 회원가입 / 개인 정보 입력(?)

- board: 간단한 게시판

- gpt: 날씨에 따른 유저의 옷차림과 마스크 착용 여부를 알려줄 툴

 

3. settings. gradle 설정

rootProject.name = 'msa'
include 'member'
include 'msa-member'
include 'msa-gpt'
include 'msa-board'
include 'msa-core'

 

 

4. 루트 프로젝트의 build.gradle 세팅

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.2.4'
}

subprojects {
    group = 'org.example'
    version = '1.0-SNAPSHOT'
    sourceCompatibility = '17'

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

    configurations {
        compileOnly {
            extendsFrom annotationProcessor
        }
    }

    repositories {
        mavenCentral()
    }

    // 관리하는 모듈의 공통 dependencies
    dependencies {
        implementation('org.springframework.boot:spring-boot-starter-web')
        implementation('org.springframework.boot:spring-boot-starter-data-jdbc')
        implementation('org.springframework.boot:spring-boot-starter-jdbc')
        implementation('org.springframework.boot:spring-boot-starter-validation')
        implementation('org.springframework.boot:spring-boot-starter-data-jpa')
        implementation('org.springframework.boot:spring-boot-starter-json')
        implementation('org.springframework.boot:spring-boot-starter-mail')
        implementation('org.springframework.boot:spring-boot-starter-tomcat')

        //jsp
        implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
        implementation 'javax.servlet:jstl:1.2'

        //lombock
        compileOnly 'org.projectlombok:lombok:1.18.22'
        annotationProcessor 'org.projectlombok:lombok:1.18.22'

        //SpringSecurity
        implementation('org.springframework.security:spring-security-taglibs')
        implementation('org.springframework.security:spring-security-oauth2-client')
        implementation('org.springframework.security:spring-security-core')
        implementation('org.springframework.security:spring-security-oauth2-authorization-server')
        implementation('org.springframework.security:spring-security-oauth2-resource-server')

        //jjwt
        implementation('io.jsonwebtoken:jjwt-api:0.12.5')
        
        runtimeOnly('org.springframework.boot:spring-boot-devtools')
        runtimeOnly('io.jsonwebtoken:jjwt-jackson:0.12.5')
        runtimeOnly('io.jsonwebtoken:jjwt-impl:0.12.5')

        testImplementation platform('org.junit:junit-bom:5.10.0')
        testImplementation 'org.junit.jupiter:junit-jupiter'
        testImplementation('org.springframework.boot:spring-boot-starter-test')
        testImplementation('org.springframework.security:spring-security-test')
        testCompileOnly 'org.projectlombok:lombok:1.18.22'
        testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
    }

    test {
        useJUnitPlatform()
    }
}

project(':msa-core') {
    bootJar { enabled = false }
    jar { enabled = true }
}

project(':msa-member') {
    dependencies {
        compileOnly project(':msa-core')
    }
}

project(':msa-gpt') {
    dependencies {
        compileOnly project(':msa-core')
    }
}

project(':msa-board') {
    dependencies {
        compileOnly project(':msa-core')
    }
}

 

 

주의: 유저 개인 정보는 core모듈로 가야 할까?(board / gpt 모두에서 사용될 예정)