Jenkins + Maven + SVN to realize automatic code packaging and distribution

Time:2019-11-13

Preface

As may be known to many partners, in the early stage of general Internet enterprises, most of them adopt the way of manual package, upload and release to release codes. The common way is to use the package tool to manually package, upload to the web server, back up the original code file, release new codes, restart services and test whether the release is successful;

As time goes on, there are more and more web clusters. This manual operation will greatly reduce the production efficiency. Therefore, a kind of “continuous integration” has been implemented. As for what is “continuous integration”, please Baidu or Google

Today, I want to talk to you about a small part of “continuous integration”: the function of automatically packaging and releasing code, which is also commonly used in production environment.

Install JDK and Tomcat environment

Install JDK and Tomcat environment

[[email protected]centos6 ~]# tar zxf jdk-8u111-linux-x64.tar.gz -C /usr/local/

[[email protected] ~]# tar zxf apache-tomcat-8.5.9.tar.gz -C /usr/local/

[[email protected] local]# export JAVA_HOME=/usr/local/jdk1.8.0_111

[[email protected] local]# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

[[email protected] local]# export PATH=$JAVA_HOME/bin:$PATH

[[email protected] local]# export CATALINA_HOME=/usr/local/apache-tomcat-8.5.9

[[email protected] local]# source /etc/profile

[[email protected] local]# java -version

java version "1.8.0_111"

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Install configuration Jenkins

Download the installation package on the official website

[[email protected] ~]# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

[[email protected] ~]#cp jenkins.war /usr/local/apache-tomcat-8.5.9/webapps/

[[email protected] webapps]#../bin/startup.sh &

Log in to the web interface for relevant configuration

Jenkins + Maven + SVN to realize automatic code packaging and distribution

Prompt for password

Jenkins + Maven + SVN to realize automatic code packaging and distribution

The initial password can be found in the following file

[[email protected] webapps]# cat /root/.jenkins/secrets/initialAdminPassword

0d647a32992149b3b43f77e4bda93809

Enter the password and jump to the next interface

Then choose to install the plug-in, and the next step will be

Jenkins + Maven + SVN to realize automatic code packaging and distribution
installation is complete

Create user and password

Jenkins + Maven + SVN to realize automatic code packaging and distribution

After completion, you can enter the homepage interface for configuration and management

Jenkins + Maven + SVN to realize automatic code packaging and distribution

Next, install the following plug-ins

Install Maven plug-in through system management – plug-in management

Because uploading pictures often fails and there are many pictures in the installation steps, you can visit the following address if you need to read the full text:
Portal

Jenkins + Maven + SVN to realize automatic code packaging and distribution

Recommended Today

Custom factory class

using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; namespace LYZB.ApiConfig { /// ///Custom factory class /// // generic public abstract class AssesUtil where T : class,new() { /// ///Cache collection /// private static Hashtable hash = Hashtable.Synchronized(new Hashtable()); /// ///Execution instance method /// ///Method name ///Parameter type ///Parameter entity /// public […]