client-external-axxx
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
client-external-bxxx
<dependencies>
<dependency>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</dependency>
<dependency>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</dependency>
...
</dependencies>
이 두 pom.xml을 참고하여 새로운 모듈을 만들었다.
client-external-cxxx
<dependencies>
<dependency>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</dependency>
<dependency>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</dependency>
</dependencies>
client-external-cxxx 에 있는 cServiceImple 에서 @Service
와 @Slf4j
를 사용하기 위해 관련 패키지를 import 하였을 때 에러는 없었지만 app 실행과정에서 에러가 발생했다.
java: package org.slf4j does not exist
아니 분명 import 되었는데...
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@RequiredArgsConstructor
@Service
public class CxxxServiceImpl implements CxxxService {...}
문제는 이 두 dependency에 있었다.
현재 프로젝트는 스프링부트인데 dependency로 들어온 group이 스프링프레임워크여서 lombok 패키지가 아니라 org.slf4j를 찾는 것 같다.
cxxx 모듈의 pom.xml을 아래와 같이 수정해주니(스프링부트로 명시해주니) 에러없이 잘 돌아간다.
<dependencies>
<dependency>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.boot</groupId>
</dependency>
<dependency>
<artifactId>spring-boot-starter-test</artifactId>
<groupId>org.springframework.boot</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</dependency>
</dependencies>
maven에 라이브러리를 추가할 때 어떤 라이브러리가 어떻게 작용하는지 공부해 봐야 겠다....