티스토리 뷰

개요

최상위 프로젝트 build.gralde을 통하여 하위 프로젝트들을 관리하려 함.

내용

아래 코드처럼 common api 적용하였으나 하위 모듈에서 라이브러리를 읽어오지 못함.

rootProject.name = 'mlmall'
include 'app-auth'
buildscript {
	ext{
		springBootVersion = '2.7.1'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
		classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
	}
}

subprojects {
	group = 'com'
	version = '0.0.1-SNAPSHOT'

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

	sourceCompatibility = '17'

	configurations {
		compileOnly {
			extendsFrom annotationProcessor
		}
	}

	dependencies {
		implementation 'org.springframework.boot:spring-boot-starter-security'

		implementation 'org.springframework.boot:spring-boot-starter-web'
		implementation "org.springframework.boot:spring-boot-starter-data-jpa"
		compileOnly 'org.projectlombok:lombok'
		annotationProcessor 'org.projectlombok:lombok'

		runtimeOnly group: 'com.h2database', name: 'h2'


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

	tasks.named('test') {
		useJUnitPlatform()
	}
}

project(':app-auth') {
	dependencies {
	}
}

 

해결

subprojects에 repositoryes를 추가함.

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

subprojects {
	group = 'com'
	version = '0.0.1-SNAPSHOT'

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

	sourceCompatibility = '17'

	configurations {
		compileOnly {
			extendsFrom annotationProcessor
		}
	}

	repositories {
		mavenCentral()
	}

	dependencies {
		compileOnly 'org.projectlombok:lombok'
		annotationProcessor 'org.projectlombok:lombok'

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

	tasks.named('test') {
		useJUnitPlatform()
	}
}

project(':app-auth') {
	dependencies {
		compile project(':app-common')
	}
}

project(':app-common') {
	dependencies {
	}
}

 

회고

멀티모듈을 이렇게까지 설정해본건 처음인데 생각보다 복잡했다.

이제 모듈과 모듈 사이 관계도 조정해야하는데 잘 안되서 한참 헤맬 듯 하다.

 

참고블로그

https://jojoldu.tistory.com/123

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함