Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation configuration of jenkins+gitlab+maven+tomcat continuous integration environment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Jenkins+gitlab+maven+tomcat, this environment mainly implements automatic construction and deployment of java web applications.

The workflow is that submitting the code to gitlab--jenkins triggers the build task-- maven compilation and packaging-- and jenkins deploys the war package to tomcat.

Install JDK

# install jdk1.8tar zxvf jdk-8u77-linux-x64.gz# and set the environment variable # vi / etc/profileexport JAVA_HOME=/usr/local/jdk1.8.0_77export JAVA_BIN=/usr/local/jdk1.8.0_77/binexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME JAVA_BIN PATH CLASSPATH

Install maven

Wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gztar zxvf apache-maven-3.3.9-bin.tar.gz# sets the environment variable MAVEN_HOME=/usr/local/apache-maven-3.3.9export MAVEN_HOMEexport PATH=$ {PATH}: ${MAVEN_HOME} / bin# to view the maven version mvn-v

Install jenkins

Wget-O / etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.reporpm-- import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.keyyum install-y jenkinsln-s / usr/local/jdk1.8.0_77/bin/* / usr/bin/# configuration jenkinsvi / etc/sysconfig/jenkins# launch jenkinsservice jenkins start

Install gitlab

Http://hz999.blog.51cto.com/10862775/1713523

Http://lansgg.blog.51cto.com/5675165/1760578

Log in to root and modify jenkins user settings:

Vi / etc/passwd# is modified to / bin/bash, otherwise you cannot log in to jenkins:x:498:499:Jenkins Continuous Integration Server:/var/lib/jenkins:/bin/bash# to set the password passwd jenkins

Set the jenkins user git global variable

Su jenkinsgit config-global user.name "Jenkins" git config-global user.email "jenkins@abc.com"

Generate secret key

Ssh-keygen-t rsa# password is empty

Gitlab add jenkins public key

Set up jenkins

System Administration-system Settings

JDK:

Maven:

Install the plug-in

Deploy to container Plugin

Gitlab Hook Plugin

GitLab Plugin

Create a new task

Source code management, select git

Set git authentication method to secret key authentication, and set private key

Build trigger

This option is that each change to the gitlab master branch triggers the build process.

Construction

Deploy the built war package to tomcat

Manager user name and Manager password are administrative usernames and passwords for tomcat

# vi tomcat-users.xml

Set up gitlab web hooks

The URL address is GitLab CI Service URL in the jenkins trigger setting

Reference documentation:

Http://www.thinksaas.cn/group/topic/378471/

Http://www.360doc.com/content/14/0603/15/9552892_383278847.shtml

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report