[Issue] Gradle implementation ์์ฑ์ ์ฃผ์ํ ์
๐ ๊ฐ์
p6spy ๋ก๊ทธ ์ฌ์ฉํด๋ณด๊ธฐ ์ํด์ ์ค์ ์ค SpringBoot๊ฐ ๋ฉ์ด์ ๋ฒ์ 3.0.x์ด ๋ฐฐํฌ๋จ์ ๋ฐ๋ผ ์ง์ ์ฌ๋ถ ๋ฐ ํธํ ๋ฐฉ๋ฒ์ ์ฐพ๋ค๊ฐ groovy ๋ฌธ๋ฒ ๋ฒ์ ์๋ชป ์์ฑํ๋ฉด์ ๋ฐ์๋ ์ด์๋ฅผ ์ ๋ฆฌํ์๋ค.
Spring Boot 3 ์ง์ ์ด์ ๊ธ์์ ํ์ธํ ์ ์๋ฏ ์ ์์ ์ผ๋ก ๋ง์ด๊ทธ๋ ์ด์ ์ด ๋์ด Spring Boot DataSource Decorator๋ฅผ ์คํ๋ง ๋ถํธ 3์์๋ ์ฌ์ฉํ ์ ์๋ค.
Spring Boot 3 Support · Issue #77 · gavlyukovskiy/spring-boot-data-source-decorator
It seems like the library is no longer working out of the box with Spring Boot 3. I read other people were having issues, and I tried it myself and wouldn't get the logs running. It'd seem as thoug...
github.com
๋ฐ๋ผ์, ๋ณธ์ธ๋ ํ๋ก์ ํธ build.gradle ํ์ผ์ ๋ค์๊ณผ ๊ฐ์ด ์์ฑํ์๋ค.
...
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'
}
...
๋ง์ง๋ง ์ค์ ์์ ๊ฐ์ ์์๋๋ก Quick Start์์ ์์ฑ๋ ์ด๋ฆ๊ณผ version์ ์์ฑํ์ฌ ๋ฃ์๋๋ฐ console ์ฐฝ์ p6spy ๋ก๊ทธ๊ฐ ์์ฑ๋์ง ์์๋ค.
๊ตฌ๊ธ๋ง์ ํตํด ๋ฌธ์๋ฅผ ์ฝ๊ณ ์ฐพ์๋ณด์์ผ๋ ์ด์ ๋ฅผ ์ฐพ์ ์ ์๋ค๊ฐ ๋ค์ ์ฒ์๋ถํฐ ์์กด์ฑ ์ถ๊ฐ๋ถํฐ ๋ค์ ํ์๋ค.
๐จ ๋ณ๊ฒฝ๋ ์ฌํญ
์์กด์ฑ ์ถ๊ฐ์ Quick Start์ ์์ฑ๋ ์ฝ๋๋ฅผ ๊ทธ๋๋ก ๋ณต์ฌ ๋ถ์ฌ๋ฃ๊ธฐ ํ์๋๋ฐ ๊ธฐ์กด์ groovy ๋ฌธ๋ฒ๊ณผ ๋ค๋ฅด๊ฒ ์์ฑ๋์ด ์์ด ์์ํ์์ผ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ๊ณ ์ผ๋จ ์คํํด ๋ณด์๋ค.
...
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation("com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0")
}
...
์คํ ํ ์ ์์ ์ผ๋ก p6spy ๋ก๊ทธ๊ฐ ์ฌ๋ผ์๋ค.
โก๏ธ ์ ๋ฆฌ
groovy ๋ฌธ๋ฒ์์ ๊ดํธ๋ ์๋ต์ด ๊ฐ๋ฅํ๊ณ ๋ฐ์ดํ์ ์๋ฐ์ดํ๋ ๋ ๋ค ๋ฌธ์์ด(String literals)์ ์๋ฏธํ๋ค.
๋ฐ์ดํ์ ์๋ฐ์ดํ์ ์ฐจ์ด์ ์ ๋ณด๊ฐ ๊ธฐ๋ฅ ์ ๋ฌด์ด๋ค.
์ ๋ฐ์ดํ์ ๊ฒฝ์ฐ ๋ณ์์ ๊ฐ์ ๊ฐ์ `$`๊ธฐํธ์ ํจ๊ป ๋ฃ์ ์ ์๋ค.
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion" // this line works
implementation 'com.squareup.okhttp3:okhttp:$okhttpVersion' // this line doesn't work
์คํ๋ ์ฐจ์ด์ ์ ๋ฐ๋ฅด๋ฉด ๋ฐ์ดํ์ ์๋ฐ์ดํ์ ์ฐจ์ด์ ๋ฐ๋ฅธ ๋ฌธ์ ์ ๊ฐ๋ค. ํ์ง๋ง ์ค์ง์ ์ผ๋ก ์์ implementation ์ฝ๋์์ ๋ณด๊ฐ์ ๋ฐ๋ฅธ ์ฐจ์ด๋ ์๋ค๊ณ ์๊ฐ๋์ด ์ ์ด๋ฐ ๋ฌธ์ ๊ฐ ์ผ์ด๋๋๊ฑด์ง ์์ง์ ์ ๋ชจ๋ฅด๊ฒ ๋ค. ๋ง์ฝ ๋ณธ์ธ์ด ${version}๊ณผ ๊ฐ์ด ๋ณ์์ฒ๋ผ ์ฌ์ฉํ๋ค๋ฉด ๋ณด๊ฐํ๋ ๊ณผ์ ์์ ์ธ์์ด ์๋๋ค๊ณ ์๊ฐํ์ ๊ฒ์ด๋ค. ์์กด์ฑ ์ถ๊ฐ ๊ณผ์ ์์ ๋ฒ์ ๊ธฐ์ ์ ๋ฌด์ ๋ฐ๋ฅธ ๋ณด๊ฐ ์ฐจ์ด๊ฐ ์๋์ง๋ ๋ชจ๋ฅด๊ฒ ์ผ๋ ์ข ๋ groovy์ gradle์ ๋ํด ๊ณต๋ถํด๋ด์ผํ ํ์๊ฐ ์๋ ๋ฏ ํ๋ค.
์ฐธ๊ณ
What are the differences of various ways to write dependencies in Gradle?
I have seen the following different ways of writing the dependencies in Gradle: implementation("com.squareup.okhttp3:okhttp:3.12.0") and implementation 'com.squareup.okhttp3:okhttp:3.12.0' and
stackoverflow.com
Gradle Single vs Double Quotes
I'm new to gradle and am currently just trying to follow the tutorials and quite a few times I've seen single and double quotes intermixed. I just wanted to know if there was a difference of when o...
stackoverflow.com