You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
4.7 KiB
Markdown

3 weeks ago
# Nexus 환경 빠른 시작 가이드
폐쇄망 환경에서 내부 Nexus를 사용하여 프로젝트를 빌드하는 빠른 가이드입니다.
## 1단계: Nexus 정보 확인
DevOps 팀 또는 Nexus 관리자에게 다음 정보를 받으세요:
```
Nexus URL: http://nexus.your-company.com:8081
Username: your-username
Password: your-password
```
## 2단계: gradle.properties 파일 생성
### Windows
```cmd
cd D:\workspace\springbatch-test
copy gradle.properties.example gradle.properties
notepad gradle.properties
```
### Linux/Mac
```bash
cd /workspace/springbatch-test
cp gradle.properties.example gradle.properties
vi gradle.properties
```
### 설정 내용
```properties
nexusUrl=http://nexus.your-company.com:8081
nexusUsername=your-username
nexusPassword=your-password
```
## 3단계: build.gradle 수정
`build.gradle` 파일의 repositories 섹션 수정:
### 변경 전
```gradle
repositories {
// 폐쇄망 환경에서는 아래 Nexus 설정을 사용하고 mavenCentral()은 주석 처리
// Use Nexus repository in closed network environment
// Uncomment below and comment out mavenCentral()
/*
maven {
url = "${nexusUrl}/repository/maven-public/"
credentials {
username = "${nexusUsername}"
password = "${nexusPassword}"
}
allowInsecureProtocol = false
}
*/
// 인터넷 접속 가능 환경
mavenCentral()
}
```
### 변경 후
```gradle
repositories {
// 폐쇄망 환경에서는 아래 Nexus 설정을 사용하고 mavenCentral()은 주석 처리
maven {
url = "${nexusUrl}/repository/maven-public/"
credentials {
username = "${nexusUsername}"
password = "${nexusPassword}"
}
allowInsecureProtocol = true // HTTP 사용 시
}
// 인터넷 접속 가능 환경 - 주석 처리!
// mavenCentral()
}
```
## 4단계: settings.gradle 수정 (선택사항)
Plugin도 Nexus에서 다운로드하려면:
### 변경 전
```gradle
/*
pluginManagement {
repositories {
maven {
url = "${nexusUrl}/repository/gradle-plugins/"
...
}
}
}
*/
```
### 변경 후
```gradle
pluginManagement {
repositories {
maven {
url = "${nexusUrl}/repository/gradle-plugins/"
credentials {
username = "${nexusUsername}"
password = "${nexusPassword}"
}
allowInsecureProtocol = true // HTTP 사용 시
}
maven {
url = "${nexusUrl}/repository/maven-public/"
credentials {
username = "${nexusUsername}"
password = "${nexusPassword}"
}
allowInsecureProtocol = true
}
}
}
```
## 5단계: 빌드 테스트
```bash
# Windows
gradlew.bat clean build --refresh-dependencies
# Linux/Mac
./gradlew clean build --refresh-dependencies
```
## 6단계: 빌드 성공 확인
```
BUILD SUCCESSFUL in 15s
```
성공 메시지가 나오면 완료!
## 트러블슈팅
### 문제 1: 인증 실패 (401 Unauthorized)
**증상:**
```
> Could not resolve all dependencies
> HTTP 401 Unauthorized
```
**해결:**
1. gradle.properties의 사용자명/비밀번호 확인
2. Nexus 웹에서 로그인 테스트: `http://nexus.company.com:8081`
### 문제 2: SSL 인증서 오류
**증상:**
```
> PKIX path building failed
```
**해결:**
1. HTTPS 대신 HTTP 사용 시도
2. `allowInsecureProtocol = true` 설정 확인
### 문제 3: 의존성을 찾을 수 없음
**증상:**
```
> Could not find org.springframework.boot:spring-boot-starter-batch:2.7.18
```
**해결:**
1. Nexus 관리자에게 라이브러리 확인 요청
2. Nexus 웹에서 검색: Browse → maven-public
3. Proxy 설정 확인 요청
### 문제 4: HTTP 프로토콜 오류
**증상:**
```
> Using insecure protocols with repositories is not allowed
```
**해결:**
build.gradle에 `allowInsecureProtocol = true` 추가:
```gradle
maven {
url = "http://..."
allowInsecureProtocol = true // 이 줄 추가!
}
```
## 체크리스트
- [ ] Nexus URL, Username, Password 확인
- [ ] gradle.properties 파일 생성 및 설정
- [ ] build.gradle에서 Nexus 주석 해제
- [ ] build.gradle에서 mavenCentral() 주석 처리
- [ ] allowInsecureProtocol 설정 (HTTP 사용 시)
- [ ] settings.gradle 수정 (plugin 사용 시)
- [ ] 빌드 테스트 성공
## 추가 도움말
상세한 설정은 `NEXUS_SETUP.md` 파일을 참고하세요.
```bash
# 전체 가이드
cat NEXUS_SETUP.md
# 또는 편집기로 열기
notepad NEXUS_SETUP.md
```
## 문의
문제 발생 시:
1. NEXUS_SETUP.md의 트러블슈팅 섹션 확인
2. DevOps 팀 또는 Nexus 관리자에게 문의
3. 네트워크 팀에 방화벽 설정 확인