Skip to content

Commit 4c1a88e

Browse files
author
abel
committed
멀티 모듈로 분리
1 parent a6a65b7 commit 4c1a88e

File tree

75 files changed

+241
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+241
-41
lines changed

Diff for: build.gradle

+64-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,74 @@
1-
plugins {
2-
id 'org.springframework.boot' version '2.1.4.RELEASE'
3-
id 'java'
4-
id "org.sonarqube" version "2.7"
1+
buildscript {
2+
ext {
3+
springBootVersion = '2.1.4.RELEASE'
4+
}
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
11+
classpath "io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE"
12+
}
513
}
614

7-
apply plugin: 'io.spring.dependency-management'
15+
subprojects {
16+
apply plugin: 'java'
17+
apply plugin: 'org.springframework.boot'
18+
apply plugin: 'io.spring.dependency-management'
19+
20+
sourceCompatibility = 1.8
21+
22+
repositories {
23+
mavenCentral()
24+
}
825

9-
group = 'com.rest'
10-
version = '0.0.1-SNAPSHOT'
11-
sourceCompatibility = '8'
26+
configurations {
27+
compileOnly {
28+
extendsFrom annotationProcessor
29+
}
30+
}
1231

13-
configurations {
14-
compileOnly {
15-
extendsFrom annotationProcessor
32+
// 모든 모듈에서 사용하는 라이브러리
33+
dependencies {
34+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
35+
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
36+
implementation 'org.springframework.boot:spring-boot-starter-web'
37+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
38+
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
39+
//embedded-redis
40+
implementation 'it.ozimov:embedded-redis:0.7.2'
41+
implementation 'io.springfox:springfox-swagger2:2.6.1'
42+
implementation 'io.springfox:springfox-swagger-ui:2.6.1'
43+
implementation 'net.rakugakibox.util:yaml-resource-bundle:1.1'
44+
implementation 'com.google.code.gson:gson'
45+
compileOnly 'org.projectlombok:lombok'
46+
runtimeOnly 'com.h2database:h2'
47+
runtimeOnly 'mysql:mysql-connector-java'
48+
annotationProcessor 'org.projectlombok:lombok'
49+
testImplementation 'org.springframework.security:spring-security-test'
50+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
1651
}
1752
}
1853

19-
repositories {
20-
mavenCentral()
54+
project(':module-common') {
55+
// 향후 common 모듈에만 필요한 라이브러리가 발생하면 이곳에 추가한다.
56+
dependencies {
57+
implementation 'org.springframework.boot:spring-boot-starter-security'
58+
implementation 'io.jsonwebtoken:jjwt:0.9.1'
59+
}
2160
}
2261

23-
dependencies {
24-
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
25-
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
26-
implementation 'org.springframework.boot:spring-boot-starter-web'
27-
implementation 'org.springframework.boot:spring-boot-starter-security'
28-
implementation 'org.springframework.boot:spring-boot-starter-actuator'
29-
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
30-
//embedded-redis
31-
implementation 'it.ozimov:embedded-redis:0.7.2'
32-
implementation 'io.jsonwebtoken:jjwt:0.9.1'
33-
implementation 'io.springfox:springfox-swagger2:2.6.1'
34-
implementation 'io.springfox:springfox-swagger-ui:2.6.1'
35-
implementation 'net.rakugakibox.util:yaml-resource-bundle:1.1'
36-
implementation 'com.google.code.gson:gson'
37-
compileOnly 'org.projectlombok:lombok'
38-
runtimeOnly 'com.h2database:h2'
39-
runtimeOnly 'mysql:mysql-connector-java'
40-
annotationProcessor 'org.projectlombok:lombok'
41-
testImplementation 'org.springframework.security:spring-security-test'
42-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
62+
project(':module-user') {
63+
// 향후 user 모듈에만 필요한 라이브러리가 발생하면 이곳에 추가한다.
64+
dependencies {
65+
compile project(':module-common')
66+
}
4367
}
68+
69+
project(':module-board') {
70+
// 향후 board 모듈에만 필요한 라이브러리가 발생하면 이곳에 추가한다.
71+
dependencies {
72+
compile project(':module-common')
73+
}
74+
}

Diff for: module-board/.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
HELP.md
2+
.gradle
3+
/build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
6+
### STS ###
7+
.apt_generated
8+
.classpath
9+
.factorypath
10+
.project
11+
.settings
12+
.springBeans
13+
.sts4-cache
14+
15+
### IntelliJ IDEA ###
16+
.idea
17+
*.iws
18+
*.iml
19+
*.ipr
20+
/out/
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
29+
### VS Code ###
30+
.vscode/

Diff for: module-board/build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group 'com.rest'
6+
version '0.0.1-SNAPSHOT'
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
testCompile group: 'junit', name: 'junit', version: '4.12'
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.rest.api;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class BoardApplication {
8+
public static void main(String[] args) {
9+
SpringApplication.run(BoardApplication.class, args);
10+
}
11+
}

Diff for: module-common/.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
HELP.md
2+
.gradle
3+
/build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
6+
### STS ###
7+
.apt_generated
8+
.classpath
9+
.factorypath
10+
.project
11+
.settings
12+
.springBeans
13+
.sts4-cache
14+
15+
### IntelliJ IDEA ###
16+
.idea
17+
*.iws
18+
*.iml
19+
*.ipr
20+
/out/
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
29+
### VS Code ###
30+
.vscode/

Diff for: module-common/build.gradle

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
bootJar {
6+
enabled = false
7+
}
8+
jar {
9+
enabled = true
10+
}
11+
12+
group 'com.rest'
13+
version '0.0.1-SNAPSHOT'
14+
15+
repositories {
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
testCompile group: 'junit', name: 'junit', version: '4.12'
21+
}

Diff for: src/main/java/com/rest/api/entity/board/Post.java renamed to module-common/src/main/java/com/rest/api/entity/board/Post.java

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import lombok.Getter;
77
import lombok.NoArgsConstructor;
88
import lombok.Setter;
9-
import org.hibernate.annotations.Proxy;
109

1110
import javax.persistence.*;
1211
import java.io.Serializable;

Diff for: src/main/java/com/rest/api/repo/UserJpaRepo.java renamed to module-common/src/main/java/com/rest/api/repo/UserJpaRepo.java

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.rest.api.entity.User;
44
import org.springframework.data.jpa.repository.JpaRepository;
5+
56
import java.util.Optional;
67

78
public interface UserJpaRepo extends JpaRepository<User, Long> {

Diff for: src/main/java/com/rest/api/service/board/BoardService.java renamed to module-common/src/main/java/com/rest/api/service/board/BoardService.java

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.rest.api.service.board;
22

3-
import com.rest.api.advice.exception.CForbiddenWordException;
43
import com.rest.api.advice.exception.CNotOwnerException;
54
import com.rest.api.advice.exception.CResourceNotExistException;
65
import com.rest.api.advice.exception.CUserNotFoundException;
@@ -17,12 +16,10 @@
1716
import lombok.RequiredArgsConstructor;
1817
import lombok.extern.slf4j.Slf4j;
1918
import org.springframework.cache.annotation.CacheEvict;
20-
import org.springframework.cache.annotation.CachePut;
2119
import org.springframework.cache.annotation.Cacheable;
2220
import org.springframework.stereotype.Service;
2321

2422
import javax.transaction.Transactional;
25-
import java.util.Arrays;
2623
import java.util.List;
2724
import java.util.Optional;
2825

Diff for: src/test/java/com/rest/api/cache/CacheTest.java renamed to module-common/src/test/java/com/rest/api/cache/CacheTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import org.springframework.boot.test.context.SpringBootTest;
88
import org.springframework.test.context.junit4.SpringRunner;
99

10-
import static org.junit.Assert.*;
10+
import static org.junit.Assert.assertEquals;
11+
import static org.junit.Assert.assertSame;
1112

1213
@RunWith(SpringRunner.class)
1314
@SpringBootTest

Diff for: src/test/java/com/rest/api/controller/v1/UserControllerTest.java renamed to module-common/src/test/java/com/rest/api/controller/v1/UserControllerTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.springframework.util.LinkedMultiValueMap;
2121
import org.springframework.util.MultiValueMap;
2222

23-
import java.util.Collections;
2423
import java.util.Optional;
2524

2625
import static org.junit.Assert.assertTrue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.rest.api.controller.v1.board;
2+
3+
public class BoardControllerTest {
4+
5+
}

Diff for: src/test/java/com/rest/api/service/social/KakaoServiceTest.java renamed to module-common/src/test/java/com/rest/api/social/KakaoServiceTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
package com.rest.api.service.social;
1+
package com.rest.api.social;
22

33
import com.rest.api.model.social.KakaoProfile;
4+
import com.rest.api.service.social.KakaoService;
45
import org.junit.Ignore;
56
import org.junit.Test;
67
import org.junit.runner.RunWith;
78
import org.springframework.beans.factory.annotation.Autowired;
89
import org.springframework.boot.test.context.SpringBootTest;
910
import org.springframework.test.context.junit4.SpringRunner;
1011

11-
import static org.junit.Assert.*;
12+
import static org.junit.Assert.assertEquals;
13+
import static org.junit.Assert.assertNotNull;
1214

1315
@RunWith(SpringRunner.class)
1416
@SpringBootTest

Diff for: module-user/.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
HELP.md
2+
.gradle
3+
/build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
6+
### STS ###
7+
.apt_generated
8+
.classpath
9+
.factorypath
10+
.project
11+
.settings
12+
.springBeans
13+
.sts4-cache
14+
15+
### IntelliJ IDEA ###
16+
.idea
17+
*.iws
18+
*.iml
19+
*.ipr
20+
/out/
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
29+
### VS Code ###
30+
.vscode/

Diff for: module-user/build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group 'com.rest'
6+
version '0.0.1-SNAPSHOT'
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
testCompile group: 'junit', name: 'junit', version: '4.12'
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.rest.api;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class UserApplication {
8+
public static void main(String[] args) {
9+
SpringApplication.run(UserApplication.class, args);
10+
}
11+
}

Diff for: settings.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ pluginManagement {
44
}
55
}
66
rootProject.name = 'api'
7+
include 'module-common'
8+
include 'module-board'
9+
include 'module-user'
10+

0 commit comments

Comments
 (0)