CI,CD/Build

[Maven] Return code is: 501 ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at wrong local POM 오류 조치

호형 2022. 4. 19. 10:57

maven project를 빌드 중에 다음과 같은 오류가 발생했다. 

Parsing POMs
ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.5.4 from http://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. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.5.4 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.5.4/spring-boot-starter-parent-2.5.4.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at wrong local POM @ line 5, column 10

조금 찾아보니 다음과 같은 문제가 있었다.. (그런데 여지껏은 잘 쓰다가 갑자기 왜!?)

Maven Central Repository에서 제공하는 Artifact를 다운로드할때 HTTP 방식은 지원하지 않고 HTTPS로 접근해야 한다는 것이다. (since 2019.12.20) 따라서 http://repo1.maven.org 및 http://repo.maven.apache.org/에 액세스하려고 하면 오류가 발생하며, 사용자가 빌드를 업데이트하여 HTTPS에 대한 종속성을 해결해야 한다고 한다. 

 

해결책 : 다음과 같이 HTTPS를 사용하도록 조치하면 된다. 

<repositories> 
   <repository> 
      <id>central</id> 
      <name>Central Repository</name> 
      <url>https://repo.maven.apache.org/maven2</url> 
      <layout>default</layout> 
      <snapshots> 
         <enabled>false</enabled> 
      </snapshots> 
   </repository> 
</repositories>

 

끝!