Troubleshooting

[Issue] Gradle implementation ์ž‘์„ฑ์‹œ ์ฃผ์˜ํ•  ์ 

DuL2 2023. 4. 21. 17:52

๐Ÿ“Œ ๊ฐœ์š”

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