Jenkins + maven + SVN + Tomcat automatic deployment

Source: Internet
Author: User

What does Jenkins do with it if you don't know please Google yourself

The popular saying that Jenkins can help us compile the release code, such as when we submit to SVN, to publish the run, we can use Jenkins to compile and run

Environment (here is the main label of my environment):

1:SVN Server Project Checkout address HTTPS://192.168.1.22/SVN/TRUNK/CRM (CentOS)

2:maven http://192.168.1.23:8080 (Cnetos)

3:tomcat Web server http://192.168.1.24:10086 (CentOS) #这个tomcat我使用的不是8080因为这个端口要让jenkins来使用. Of course these are not fixed!!

Note: Because my side is a test environment, Jemkins put it on the Tomcat Web server.

Formally deploying Jenkins

A: Login 192.168.1.24 to deploy Jenkins #我使用的帐号是root, you can use the other.

The machine is equipped with TOMCAT7 and JDK8, which mainly uses the following two environment variables.

Export Java_home=/usr/local/jdk8 #环境变量

Export CATALINA_HOME=/USR/LOCAL/TOMCAT7

Mkdir-p/usr/local/jenkins #用来存放下载的jenkins

: http://mirrors.jenkins-ci.org/war/Select the installation version here

wget Http://mirrors.jenkins-ci.org/war/1.588/jenkins.war

#我这里下载的版本是 1.588 was updated in November 14. When I installed the latest version, I failed to properly install the plugin that deployed the war to Tomcat server ... Capacity issues.

Execute command java-jar jenkins.war #如果报类似下面的警告执行这个命令 Java-dhudson.dnsmulticast.disabled=true-jar Jenkins.war

November 19, 2014 4:13:12 pm javax.jmdns.impl.DNSIncoming readanswer Warning: There is an OPT answer. Not currently handled. Option code:65002 Data:6de368dadd8543b8

The general situation ends with this installation. To access the http:192.168.1.24:8080, you can see the Jenkins interface #jenkins默认使用8080 change the port to add parameters when executing the command.

Note: After executing the java-jar jenkins.war command, in the current user's home directory, a. Jenkins directory will be generated, and the resulting war files will be created in the future. If you just deployed it, there shouldn't be so many files.

B: Add item #这个项目的流程 from SVN detection code---> Compile-----> Publish to Tomcat WebApps directory.

1: Click "New" in the upper left corner to show the following interface

Note: For the convenience of our Java developers we have set up a maven to configure the address of the Maven in the Pom file of the CRM project, and when Jenkins compiles the Java code, we encounter the need for the jar package to be returned to our maven download.

2: Configure the contents of the CRM Project

A: Configuring Subversion

Select the Subversion configuration Repository URL to configure your SVN project, and then you will be prompted to configure the user and password to check out the project. Its options default

B: Click on "Add post build Steps" to select "Deploy war/ear to a Contalner" This option is only available after installing the plugin. Install the "Deploy Plugin" plugin.

Note: plugin: HTTP://FTP.YZ.YAMAGATA-U.AC.JP/PUB/MISC/JENKINS/PLUGINS/DEPLOY/1.10/DEPLOY.HPI download plugin later through System management-- > Advanced upload plugin and then restart Jenkins (it may expire in a long time)

C: Configure the related configuration of the compiled war directory with Tomcat

War/ear files is configured with a relative path relative to the workspace directory of Jenkins. My whole path is/root/.jenkins/workspace/crm/crm.adminweb/target/crm.adminweb.war.

The context Path/#/represents the WebApps directory where Crm.adminWeb.war will be replaced with Root.war in Tomcat.

Tomcat's information is primarily the username and password (from Tomcat-users.xml) and the address that Tomcat accesses http://192.168.1.24: 10086

To this Jenkins deployment automatic checkout release Java code complete ... Click on the icon with green arrows to check out the main screen and compile the---> Publish diagram #点一下就了 ... The reflection will be a little dull.




Jenkins + maven + SVN + Tomcat automatic deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.