SseopE
SseopE
SseopE
전체 방문자
오늘
어제
  • 분류 전체보기 (44)
    • Programming (3)
      • JAVA (3)
    • Spring (7)
      • 스프링 부트와 AWS로 혼자 구현하는 웹 서비스 (5)
      • Spring 공부 (0)
    • Infra (6)
      • Docker (3)
      • Kubernetes (3)
      • Kafka (0)
    • Machine Learning (2)
      • Scikit-Learn (1)
      • MLOps (1)
      • BentoML (0)
      • Kubeflow (0)
    • OS (2)
      • Linux (2)
    • Algorithm (23)
      • Sorting (7)
      • BOJ (15)
      • Programmers (0)
      • Data Structure (1)
    • 특강 (0)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 백준
  • boj
  • 2580번
  • resource
  • docker
  • 2981번
  • 도커
  • Kubernetes
  • Spring boot
  • 스웜 모드
  • 2275번
  • 자바
  • scikit learn
  • container
  • TransformMixin
  • BaseEstimator
  • 1931번
  • 1541번
  • java
  • Spring

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
SseopE

SseopE

Spring

Gradle issue (compile : No candidates found for method call)

2022. 4. 7. 18:44
buildscript {
    ext {
        springBootVersion = '2.1.7.RELEASE'
    }
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
    id 'java'
    id 'eclipse'
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.7.RELEASE'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.projectlombok:lombok')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('com.h2database:h2')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

Spring-boot 를 추가하기 위해 다음과 같이 gradle을 설정하였다.

이때 dependencies 부분에 compile과 testCompile 부분이 No candidates found for method call 라는 오류를 출력했는데 이는 gradle 버전이 상승하면서 생긴 오류였다. compile이 deprecated되면서 없어졌고 implementation으로 변경됬다고 한다. 만약, compile을 사용하려면 api를 이용해야 한다.

 

compile, implementation 둘간의 차이는

api(compile)

The dependencies required to compile the production source of the project which are part of the API exposed by the project. For example the project uses Guava and exposes public interfaces with Guava classes in their method signatures.

implementation

The dependencies required to compile the production source of the project which are not part of the API exposed by the project. For example the project uses Hibernate for its internal persistence layer implementation.

compile의 경우 A라는 모듈을 수정하게 되면 A와 직, 간접적으로 연관된 모든 모듈이 재빌드 되야하고,implementation의 경우 A라는 모듈을 수정하게 되면 A와 직접적으로 연관된 모듈만 재빌드 하면 된다.

 

implementation의 장점으로는

1. 속도가 빠르다.

2. api 노출 문제

 - 필요한 api만 노출하여 불필요한 정보 노출을 막는 역할도 한다.

 

dependencies 부분을

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation('org.projectlombok:lombok')
    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    implementation('com.h2database:h2')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

다음과 같이 바꿔서 오류를 해결했다.

'Spring' 카테고리의 다른 글

Gradle issue (plugins, lombok)  (0) 2022.04.07
    'Spring' 카테고리의 다른 글
    • Gradle issue (plugins, lombok)
    SseopE
    SseopE

    티스토리툴바