넥서스 설정
넥서스 설치
Section titled “넥서스 설치”- 설치 문서를 참조해서 설정한다.
넥서스 환경 설정
Section titled “넥서스 환경 설정”리파지토리 설정
Section titled “리파지토리 설정”- nuget 리파지토리 제거
- 경로
- Settings -> Repository -> Repositories
- 상세보기 상태에서
Delete repository버튼 클릭- nuget-group
- nuget-hosted
- nuget.org-proxy
- 경로
- maven 리파지토리 제거 (Optional)
- 백앤드 개발을 하지 않는 경우에는 삭제한다.
- 경로
- Settings -> Repository -> Repositories
- 상세보기 상태에서
Delete repository버튼 클릭- maven-central
- maven-public
- maven-releases
- maven-snapshots
- npm 리파지토리 생성
- 경로
- Settings -> Repository
- 목록 상단의
Create repository버튼 클릭 - npm-group 리파지토리 생성
- Recipe 목록에서
npm (proxy)선택 - Name:
npm-proxy입력 - Proxy -> Remote storage:
https://registry.npmjs.org입력 Create repository버튼 클릭해서 저장
- Recipe 목록에서
- npm-hosted 리파지토리 생성
- Recipe 목록에서
npm (hosted)선택 - Name:
npm-hosted입력 Create repository버튼 클릭해서 저장
- Recipe 목록에서
- npm.proxy 리파지토리 생성
- Recipe 목록에서
npm (group)선택 - Name:
npm-group입력 - Group: Available 그룹의 2개 항목을 Members 그룹으로 이동한다.
- npm-proxy
- npm-hosted
Create repository버튼 클릭해서 저장
- Recipe 목록에서
- 경로
공용 계정 생성
Section titled “공용 계정 생성”- 넥서스에 익명 접근(Anonymous Access)이 가능하도록 설정한 경우에는 추가로 계정을 만들 필요가 없다.
- 넥서스 접근을 위한 추가 계정 생성 절차.
- Role 생성
- 경로
- Settings -> Security -> Roles
- 목록 상단의
Create Role버튼 클릭- Type:
Nexus role선택 - Role ID :
nx-build입력 - Role name :
nx-build입력 - Applied Privileges
Modify Applied Privileges버튼을 클릭해서Privileges Selection팝업을 생성한다.- 아래 3개의 권한을 추가한다.
- nx-healthcheck-read
- nx-repository-view-*-*-*
- nx-search-read
Save버튼 클릭해서 저장
- Type:
- 경로
- 사용자 생성
- 경로
- Settings -> Security -> Users
- 목록 상단의
Create local user버튼 클릭- ID: 사용자 ID 입력
- First name: 개인정보 입력
- Last name: 개인정보 입력
- Email: 개인정보 입력
- Password: 패스워드 입력
- Confirm password: 패스워드 입력
- Status :
Active선택 - Roles : Grant 그룹에
nx-build추가
Create local user버튼 클릭해서 저장
- 경로
- Role 생성
익명 접근 설정
Section titled “익명 접근 설정”- 경로
- Settings -> Security -> Anonymous Access
Access항목을 설정Save버튼 클릭해서 저장
프로젝트에 넥서스 설정
Section titled “프로젝트에 넥서스 설정”- 프런트앤드 설정
- .npmrc 파일 생성
계정 홈 디렉토리에 .npmrc 파일을 생성
Terminal window touch ~/.npmrc프로젝트 루트디렉토리에 .npmrc 파일을 생성
Terminal window touch /${PROJECT_HOME}/.npmrc - .npmrc 파일 설정
.npmrc registry=${NPM_REPOSITORY_PATH} - 테스트
Terminal window npm login$ npm loginnpm notice Log in on ${NPM_REPOSITORY_PATH}Username: ${NEXUS_ACCOUNT} 입력Password: ${NEXUS_PASSWORD} 입력Logged in on ${NPM_REPOSITORY_PATH}.
- .npmrc 파일 생성
- 백앤드 설정
- 리파지토리 경로는 넥서스 기본 설정값을 그대로 사용하였다.
- 익명 접근(Anonymous Access)이 가능하계 설정된 경우에는 계정정보를 설정할 필요가 없다.
- 라이브러리 다운로드를 위한 공용(public) 레파지토이 설정
- 스냅샷을 업로드하기 위한 리파지토리를 설정
- 릴리즈 버전은 넥서스 관리자 모드에서 직접 업로드하는 방식으로 등록한다.
build.gradle ...ext {nexusUrl = 'http://localhost:8081'}repositories {maven {credentials {username "${NEXUS_ACCOUNT}"password "${NEXUS_PASSWORD}"}url "${nexusUrl}/repository/maven-public/"}}uploadArchives {repositories {mavenDeployer {repository(url: "${nexusUrl}/repository/maven-public/") {authentication(username "${NEXUS_ACCOUNT}", password "${NEXUS_PASSWORD}")}snapshotRepository(url: "${nexusUrl}/repository/maven-snapshots/") {authentication(username "${NEXUS_ACCOUNT}", password "${NEXUS_PASSWORD}")}}}}...pom.xml ...<properties><nexus.url>http://localhost:8081</nexus.url></properties><distributionManagement><snapshotRepository><id>${SNAPSHOTS_REPOSITORY_ID}</id><url>${nexus.url}/repository/maven-snapshots/</url><layout>default</layout></snapshotRepository></distributionManagement>...settings.xml <?xml version="1.0" encoding="UTF-8"?><settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><servers><server><id>${PUBLIC_REPOSITORY_ID}</id><username>${NEXUS_ACCOUNT}</username><password>${NEXUS_PASSWORD}</password></server><server><id>${SNAPSHOTS_REPOSITORY_ID}</id><username>${NEXUS_ACCOUNT}</username><password>${NEXUS_PASSWORD}</password></server></servers><mirrors><mirror><id>${PUBLIC_REPOSITORY_ID}</id><url>http://localhost:8081/repository/maven-public/</url><mirrorOf>*</mirrorOf></mirror></mirrors><activeProfiles><activeProfile>${DEFAULT_PROFILE_ID}</activeProfile></activeProfiles><profiles><profile><id>${DEFAULT_PROFILE_ID}</id><repositories><repository><id>${PUBLIC_REPOSITORY_ID}</id><url>http://localhost:8081/repository/maven-public/</url><layout>default</layout></repository><repository><id>${SNAPSHOTS_REPOSITORY_ID}</id><snapshots><enabled>true</enabled></snapshots><url>http://localhost:8081/repository/maven-snapshots/</url></repository></repositories></profile></profiles></settings>