에러(error)

Non-resolvable parent POM

 

에러 상세(detail)

pom.xml 에서 <parent> 위치에서 출력된 에러

Project build error: Non-resolvable parent POM for com.joker:joker-module1:1.0: Failure to find com.joker:joker-app:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM

 

console 에서 출력된 에러

[INFO] Scanning for projects...

[ERROR] [ERROR] Some problems were encountered while processing the POMs:

[FATAL] Non-resolvable parent POM for com.joker:joker-module1:1.0: Failure to find com.joker:joker-app:pom:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 11

 

 

플랫폼(platform)

STS 4(Spring Tool Suite 4), spring boot 2.1.3, maven, Windows10

 

 

상황(situation)

(svn을 통해) 다운받은 STS 프로젝트를 열었는데 위와 같은 에러가 발생했다. 현재 본인이 실행시킨 STS 프로젝트의 빌드 툴(build tool)은 메이븐(Maven)을 사용하고 있기 때문에, 프로젝트 내에 pom.xml 파일이 있다. 참고로, pom.xml 파일은 프로젝트를 빌드할 때 옵션을 설정해줄 수 있는 내용들이 담겨 있다. 이번 에러가 발생한 곳이 바로 이 pom.xml 파일이고, 그 안에서도 <parent>태그에서 발생한 에러이다.

 

 

원인(cause)

원인 설명

Non-resolvable parent POM for com.joker:joker-module1:1.0: Failure to find com.joker:joker-app:pom:1.0” 에러를 해석하면, com.joker:joker-module1:1.0을 빌드(build)하려는데 이 때 필요한 com.joker:joker-app:pom:1.0 파일을 찾을 수 없기 때문에 에러를 발생시킨다는 내용이다.

 

현재 실행시키려는 STS 프로젝트는 메이븐(Maven)빌드 기반의 프로젝트이다. 그리고 이 프로젝트는 몇 개의 프로젝트가 각각 모듈화해서 서로 의존적인(dependency) 구조로 만들어져 있었다. 그런데, 본인은 그 걸 모르고 한개 프로젝트만 다운받아서 실행시키려고 시도했던 것이다. 즉, 현재 에러의 원인은 실행시키려는 프로젝트를 빌드할 때 참조해야하는 다른 프로젝트가 존자해지 않아서 발생한 것이다. 참조하는 해당 프로젝트(ex, 상위 프로젝트)가 없어서  발생한 것이다.

 

※ 참고, 메이븐(Maven) project는 계층구조를 가질 수 있다. 메이븐에서 제공하는 기능 중에는 여러 개의 project를 만들고 서로 참조(dependency)를 시켜놓으면 연속으로 빌드를 할 수 있는 기능이 있다. 예를 들어 project1과 project2를 동시에 개발하는데, project1이 빌드될 때 project2가 먼저 빌드된 후 빌드되도록 할 수 있다는 것이다.

 

원인 상세 설명

현재 본인이 마주하는 상황을 좀 더 자세히 설명한다. 본인이 원래 사용하려는 (svn에 올려진) 프로젝트의 전체 구조는 아래와 같다. 총 3개의 pom.xml이 있고, 하나가 두개를 하위 계층으로 두고 있는 형태이다.

그런데, 현재 본인은 이 중에 하위계층에 있는 하나의 프로젝트(아래 빨간표시된 부분 module1)만 다운받아서 실행시키려고 했던 것이다.

그림을 보면 알 수 있듯이, module1의 pom.xml에는 <parent>태그가 존재하고 이 <parent>에 작성한 정보는 상위 계층의 Project에 있는 pom.xml을 가리키는 것이다. 그런데, 본인이 다운받은 로컬(local)에는 상위계층의 Project부터 다운받은 것이 아니기 때문에 에러가 발생한 것이다. 실제 사용했던 pom.xml파일 일부 내용은 아래와 같다.

 

Projectpom.xml

<project ...>
   	<modelVersion>4.0.0</modelVersion>
   	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.3.RELEASE</version>
		<relativePath/>
 	</parent>
 	<groupId>com.joker</groupId>
 	<artifactId>joker-app</artifactId>
 	<version>1.0</version>  
	...
 	<modules>
  		<module>joker-module1</module>
  		<module>joker-module2</module>
 	</modules>
</project>

 

module1pom.xml

<project ...>
 <modelVersion>4.0.0</modelVersion>
 <parent> <!-- 에러 발생 지점 -->
   <groupId>com.joker</groupId>
   <artifactId>joker-app</artifactId>
   <version>1.0</version>
 </parent>
 ...
</project>



해결(solution)

본인은 STS 프로젝트 일부가 아닌 전체를 받아서 다시 실행해서 문제를 해결했다. 이 에러가 발생한 근본적인 원인은 프로젝트의 dependency로 설정되어 있는 라이브러리(library)나 프로젝트가 제대로 참조되지 않고 있기 때문이라는 것이다. 따라서, 본인처럼 다른 프로젝트까지 모두 다시 가져올 수 있는 상황이라면 간단히 해결될테지만, 그게 아닌 상황이라면 프로젝트의 빌드 dependency가 어떻게 설정되어 있는지 확인하면 해결될 것으로 생각된다. 특히, pom.xml 내용 중 parent, module, relativePath에 대한 태그를 잘 살펴보는 것이 도움이 될 것이며, 문제 해결에 참고했던 사이트를 남긴다.

 

 

참고(reference)

https://meetprakashbhandari.blogspot.com/2016/08/simple-maven-multi-module-project.html