[Jenkins]
자동배포 설정
작성일자 : 2018년 07월 16일
환경 : Jenkins 2.129, JDK 1.8.0_101, Maven
3.3.9, Tomcat 7.0.88, Git 1.8, Linux
서버 #1 - Jenkins,
Git, Maven, JDK
서버 #2 – Tomcat
구성 : Jenkins - JDK, Maven 설치 및 경로 설정 / Git 연동 / Maven 빌드 설정 완료
Jenkins
작업(Build) 실행 시 저장소 동기화 및 빌드 작업(mvn install) 후 .war 파일 target에 생성
시나리오 : Jenkins 작업(Build)
수행 시 생성되는 .war 파일을 원격 WAS 서버에
배포
# 사전에 Jenkins 작업을 수행하면 배포할 파일이 생성 되는 시점 까지의 설정이 우선되는 것을 권고
1. Tomcat 설정
$ vi $TOMCAT_HOME/conf/tomcat-users.xml
.. <tomcat-users> ..
<role
rolename="manager"/>
<role
rolename="manager-script"/>
<role
rolename="manager-gui"/>
<role
rolename="manager-status"/>
<role
rolename="manager-jmx"/>
<user username="ID" password="password" roles="standard,manager,manager-script,manager-gui,manager-status,manager-jmx"/>
</tomcat-users>
..
|

manager-gui
— Access to the HTML interface.
manager-status
— Access to the "Server Status" page only.
manager-script
— Access to the tools-friendly plain text interface that is described in this
document, and to the "Server Status" page.
manager-jmx
— Access to JMX proxy interface and to the "Server Status" page.
위에서 설정한 username, password 기억!
2. Jenkins 설정
플러그인 설치


프로젝트 설정


알맞은 컨테이너 추가


Username과 password에는 tomcat-users.xml(1. Tomcat 설정)에서 설정해준 username,
password 입력

추가해준 Credentials, Tomcat, 배포 파일 설정
Context path를 지정하지 않을 경우 Jenkins Project target을 Default로 참조

3. 확인
빌드 시 서버에 자동 배포까지 진행

