본문 바로가기
카테고리 없음

JFrog Artifactory(아티팩토리) Unauthorized 인증 에러

by 모띠 2025. 1. 29.

 

 

 

본 포스팅은 총 3편으로 구성되어 있습니다.

2025.01.28 - [IT/오픈소스] - JFrog Artifactory(아티팩토리)란?

2025.01.29 - [IT/오픈소스] - JFrog Artifactory(아티팩토리) 사용하기

2025.01.29 - [IT/오픈소스] - JFrog Artifactory(아티팩토리) Unauthorized 인증 에러

 

 

아티팩토리 특정 저장소에 anonymous 유저를 추가하지 않거나 한다면 라이브러리를 받아오는 도중에 아래와 같은 401 Unauthorized 인증에러가 발생한다.

[ERROR] Failed to execute goal on project test: Could not resolve dependencies for project test:test:jar:0.0.1-SNAPSHOT: 
Failed to collect dependencies at test:test:jar:0.0.1: Failed to read artifact descriptor for test:test:jar:0.0.1: 
Could not transfer artifact test:test:pom:0.0.1 from/to bwg-public (http://ip:port/artifactory/my-repository/): 
Authentication failed for http://ip:port/artifactory/my-repository/test/test/0.0.1/test-0.0.1.pom 401 Unauthorized -> [Help 1]

 

생각해보면 당연한 현상이다.

익명사용자 접근을 막아놓았으므로 id와 pw로 접근 권한이 있는 유저만 로컬 저장소에 접근가능한 것이다.

 

id와 pw를 입력하기만 하면될텐데, 문제는 어느곳에다가 id와 pw를 입력하냐이다.

 

답은 의외로 간단하다. mvn 설정파일 settings.xml의 `<server>`부분에 입력하면된다.

각자 메이븐 설정 파일을 수정하고 잘 모르겠다면 대부분 MAVEN_HOME\config\settings.xml을 사용중일 것이다.

  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    -->
    <server>
      <id>artifactory-repo</id>
      <username>id</username>
      <password>pw</password>
    </server>

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

 

이클립스내에서도 받고싶다면 

window -> preference -> maven -> user settings -> user settings에 settings.xml을 넣어주면된다.

 

 

해당 설정까지끝나면 인증에러없이 잘 받아오게 된다.

댓글