[SpringBoot] Compile Error: > Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-data-jpa] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-data-jpa] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.'
이러한 에러가 나타났습니다.
우선 문제를 살펴보면
스플이부트에서 JPA,MYSQL CONNECT, H2DataBase를 추가하는 과정에서 문제가 발생하였습니다.
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('mysql:mysql-connector-java:')
compile('com.h2database:h2')
이러한 에러 메세지가 나왔구요.
1.처음에는 compie에 입력한 코드가 잘못되었나하고, 인터넷 여기저기서 복사붙여넣기 해보았지만 TEXT에는 문제가 없다는것을 확인했습니다.
2.다시 검색을 진행하다보니
compile, runtime, testCompile,testRuntime 은 Gradle 4.1(2018.8)이래로 deprecate되었다고 합니다.
따라서 현재 제가 사용하고있는 최신 Gradle 버젼에서는
implementation, runtimeOnly, testImplementation,testRuntimeOnly를 사용하는것이 맞습니다.
제 코드에서는 compile을 위 네개중 implementation으로 대체하여 에러해결에 성공하였습니다.
오늘도 발전합니다.
참조한글
Gradle Could not find method compile() 해결 방법
gradle 7.0 부터 compile 명령은 삭제되었습니다.
velog.io