JAVA/spring
[에러] Compile() 문제
24시간이모자란
2023. 2. 7. 01:00
문제
- org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-web] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
- compile()메소드를 찾지 못하는 에러가 발생하였다.
원인
다음 글을 참고하였다.
https://stackoverflow.com/questions/23796404/could-not-find-method-compile-for-arguments-gradle
Could not find method compile() for arguments Gradle
Looked around for this solution for much too long now, and I'm not sure if I missed it or just misstyped something, but my Gradle script will not compile. I am migrating to Gradle, and am very new ...
stackoverflow.com
compile, runtime, testCompile, testRuntime 4가지 configuration은 2018년 8/27 Gradle 4.10 버전부터 사용됐으며 2021 4/09 Gradle 7.0 버전부터 제거됐다.
4가지 메소드는 각각 implementation, runtimeOnly, testImplementation, testRuntimeOnly 으로 교체됐다.
해결
다음 코드와 같이 compile 은 implementation 으로. testCompile은 testImplementation 으로 고쳐서 해결
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}