▼ DevOps/젠킨스 (Jenkins)
Jenkins(젠킨스) | Maven, War 빌드&배포하기
Valar
2021. 9. 28. 10:38
반응형
Jenkins 설치
Jenkins + GitHub + Item(프로젝트) 생성
▶ 구성환경
Jenkins, SpringBoot, Maven, War, Linux, GitHub
Step
- Jenkins Global Tool Configuration 설정
- Jenkins Item(프로젝트) Build 구성
- Jenkins Build Now
Jenkins Global Tool Configuration 설정
Jenkins 관리 → Global Tool Configuration → Maven
Name
=> 원하는 이름으로 작성
Version
=> 실제 프로젝트 Maven 버전, /프로젝트/.mvn/wrapper/maven-wrapper.properties에 명시되어있음
Jenkins Item(프로젝트) Build, 빌드 후 조치 구성
Item(프로젝트) 상세에서 구성 선택
Build
1. invoke top-level Maven tergets 선택
2. Maven Version 선택 (Global Tool Configuration에서 생성했던 버전)
Goals 입력
clean package -D maven.test.skip=true
Goals에 대한 설명
예) clean package -P dev -D maven.test.skip=true
-P dev (설정하지 않을경우 생략 가능)
pom.xml의 profiles 설정에서 구분이 되어있을 경우
빌드할 때 설정할 profile의 id를 지정해준다.
-D maven.test.skip=true
테스트를 생략하겠다는 설정이다.
Junit을 사용하지 않을 것이므로 생략한다.
<profiles>
<!-- Local server -->
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>local</env>
</properties>
</profile>
<!-- Development server -->
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
<!-- real server -->
<profile>
<id>release</id>
<properties>
<env>release</env>
</properties>
</profile>
</profiles>
Jenkins Build Now
1. Build Now(빌드 실행 후)
2. Build History > Console Output에서 로그 확인
반응형