-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SETTING] 멀티모듈 프로젝트 세팅 - #2
- Loading branch information
Showing
18 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/gradlew text eol=lf | ||
*.bat text eol=crlf | ||
*.jar binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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/ | ||
|
||
### Mac ### | ||
.DS_Store | ||
|
||
### yml ### | ||
cakey-api/src/main/resources/application.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// plugin 이란 미리 구성해놓은 task 들의 모음이며, 특정 빌드과정에 필요한 기본정보를 포함함 | ||
plugins { | ||
id 'java'// 테스트, 번들링 기능과 함께 Java 컴파일을 추가해주며, 다른 JVM 언어 플러그인의 기반이 됨 | ||
id 'org.springframework.boot' version '3.2.1' // 실행가능한 jar 또는 war로 패키징하여 애플리케이션 실행이 가능하도록 하며, spring-boot-dependencies 기반의 의존성 관리를 사용함 | ||
id 'io.spring.dependency-management' version '1.1.4' // 자동으로 spring-boot-dependencies bom을 끌어와서 버전 관리를 해줌 | ||
} | ||
|
||
// 현재의 root 프로젝트와 앞으로 추가될 서브 모듈에 대한 설정 | ||
allprojects { | ||
|
||
group = 'com.cakey' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
// 라이브러리들을 받아올 원격 저장소들을 설정함 | ||
repositories { | ||
mavenCentral() | ||
} | ||
} | ||
|
||
//컴파일 시 필요한 애너테이션 프로세서가 올바르게 적용되도록 설정하는 역할 | ||
//allprojects안에 넣으면 안되는 이유 : allprojects는 서브 모듈의 빌드 구성 전에 실행됩니다. 만약 configurations {}를 allprojects에 넣으면, 아직 서브 모듈에서 java 플러그인이나 관련 플러그인이 적용되지 않은 상태에서 실행될 수 있습니다. | ||
//이로 인해 compileOnly 또는 annotationProcessor가 정의되지 않았다는 오류가 발생할 수 있습니다. | ||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
// 루트 제외한 전체 서브 모듈에 해당되는 설정 | ||
// settings.gradle에 include된 전체 프로젝트에 대한 공통 사항을 명시함 | ||
// root 프로젝트까지 적용하고 싶다면 allprojects에서 사용해야 함 | ||
subprojects { | ||
|
||
// subprojects 블록 안에서는 plugins 블록을 사용할 수 없으므로 apply plugin을 사용해야 함 | ||
apply plugin: "java" | ||
apply plugin: "org.springframework.boot" | ||
apply plugin: "io.spring.dependency-management" | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
// 모든 서브 모듈에서 사용될 공통 의존성들을 추가함 | ||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web:3.2.1' | ||
annotationProcessor "org.projectlombok:lombok:1.18.22" | ||
compileOnly "org.projectlombok:lombok:1.18.22" | ||
|
||
//Test | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.2.1' | ||
testCompileOnly("org.projectlombok:lombok:1.18.22") | ||
testAnnotationProcessor("org.projectlombok:lombok:1.18.22") | ||
} | ||
|
||
// 모든 서브 모듈에서 Junit을 사용하기 위한 설정 | ||
tasks.named("test") { | ||
useJUnitPlatform() | ||
} | ||
} | ||
|
||
bootJar { enabled = false } | ||
jar { enabled = true } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
plugins { | ||
id 'org.springframework.boot' //api에 있는 springBootApplication으로 실행할 것이기 때문 | ||
} | ||
|
||
dependencies { | ||
implementation project(':cakey-common') // 공통 모듈 의존성 | ||
implementation project(':cakey-domain') // 도메인 모듈 의존성 | ||
implementation project(':cakey-auth') // 인증 모듈 의존성 | ||
implementation project(':cakey-external') // 외부 모듈 의존성 | ||
|
||
implementation 'mysql:mysql-connector-java:8.0.33' | ||
implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
|
||
} | ||
|
||
// 실행가능한 jar로 생성하는 옵션, main이 없는 라이브러리에서는 false로 비활성화함 | ||
bootJar { enabled = true } | ||
|
||
// 외부에서 의존하기 위한 jar로 생성하는 옵션, main이 없는 라이브러리에서는 true로 비활성화함 | ||
jar { enabled = false } |
11 changes: 11 additions & 0 deletions
11
cakey-api/src/main/java/com/cakey/CakeyServerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.cakey; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class CakeyServerApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(CakeyServerApplication.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bootJar { enabled = false } | ||
jar { enabled = true } | ||
|
||
dependencies { | ||
implementation project(':cakey-common') // 공통 모듈 의존성 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cakey; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bootJar { enabled = false } | ||
jar { enabled = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cakey; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
bootJar { enabled = false } | ||
jar { enabled = true } | ||
|
||
dependencies { | ||
implementation project(':cakey-common') // 공통 모듈 의존성 | ||
implementation project(':cakey-auth') // 인증 모듈 의존성 | ||
implementation project(':cakey-external') // 외부 모듈 의존성 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cakey; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bootJar { enabled = false } | ||
jar { enabled = true } | ||
|
||
dependencies { | ||
implementation project(":cakey-common") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cakey; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.11.1-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.