Learning Video: http://www.maiziedu.com/course/369/
Learning materials: https://wenku.baidu.com/view/f2d72197ff00bed5b9f31d9c.html
Https://wenku.baidu.com/view/83c994c280eb6294dd886ce8.html
One. A general process for continuous integration using Jenkins:
1. First step: Upload the project.
I'm using IntelliJ Idea's Web project (spring,spring MVC, Hibernate,maven), and when I've written some of the code, I want to test it. Use Tortoise svn to upload your project to Visual SVN server,
2. Step two: Perform the build.
Built manually or timed in Jenkins, it downloads the project you just uploaded from Visual SVN Server. Windows users download to C:\Users\Administrator\AppData\Local\jenkins\workspace\hellojenkins (this is the project name), Jenkins then automatically transfers the Pom.xml file under Hellojenkins, builds, tests, and hits the war package, which is placed in the Hellojenkins\target directory. (Before you do this, try using idea to test whether Pom.xml can play the war package.) )
3. Step three: Deploy.
Put the C:\Users\Administrator\AppData\Local\jenkins\workspace\hellojenkins\target\hellojenkins.0.0.1.war package in the tomcat/ WebApp directory ...
The whole process is sorted out. Here's how to do it in detail:
1. Install the configuration Jenkins.
Download Jenkins.war package from Jenkins official website, put it under Tomcat/webapp, launch Tomcat, browser input http://localhost:8080/jenkins Enter the management interface of Jenkins (fully configured with a Web page, no database). Then click System Management and go to the system Settings screen.
The system Setup interface, most of which uses the default settings, is configured with the following path (mainly jdk,maven,ant),
Save it.
2.jenkins New, configuration job (user builds a MAVEN project),
Select New, build a MAVEN project as shown in the figure, enter the item name, called Hellojenkins
Click OK to make the Hellojenkins configuration interface.
3. Configure Hellojenkins
3.1 Configuring the Versioning tool----source control, this step I chose subversion. As shown in the following illustration,
When the Hellojenkins build is executed, the project is downloaded from this address to Jenkins, the workspace directory, such as, C:\Users\Administrator\.jenkins\workspace
3.2 Configure the deployment plug-in.
This step needs to go back to the management plugin in Jenkins System management. As pictured, download and install the Deploy Plugin
3.3 After rebooting Tomcat, go to the admin plugin interface to see if the plug-in is installed successfully, then configure the deployment. The following figure;
As shown in the figure below
3.4 Click Apply, save. (It's too early to be happy.) This step also requires the configuration of the Tomcat user,
Modify the user in the TOMCAT/CONF/TOMCAT-USER.XMF file as shown in the figure
<role rolename= "Tomcat"/>
<role rolename= "Role1"/>
<role rolename= "Manager-gui"/>
<role rolename= "Manager-script"/>
<role rolename= "Manager-jmx"/>
<role rolename= "Manager-status"/>
<role rolename= "Admin-gui"/>
<user username= "Tomcat" password= "Tomcat" roles= "Tomcat,manager-gui,admin-gui,manager-jmx,manager-script, Manager-status,role1 "/>
Here Tomcat's username and password are tomcat, which is the one written in the image above.
Restart Tomcat.
4. All work is done and the next step is to upload the MAVEN project Hellojenkins from idea to Visual SVN server via Tortoise SVN.
5. Click on the job page to build it now to view the input log.
I have an empty project in the SVN repository here, so the build failed. This should be the message prompt for the Deploy War class after the build succeeds.
This step if the project is relatively small, there is no problem. If the project uses Spring,hibernate, Tomcat may report a memory overflow error, and the solution is to add it to the first line of Catalana.bat
Set java_opts=-xms1024m-xmx1024m-xx:permsize=256m-xx:maxnewsize=512m-xx:maxpermsize=512m
This sentence is used to set the memory size.
Wordy so much, do not know can help others no, if there is a problem, send me e-mail "641041018@qq.com".
Add a schematic diagram of what should be done if SVN, Jenkins, test Tomcat, the development environment are all separated.
Jenkins also has a set of code, pulled down from SVN, to determine your SVN discovery changes, if it changes, automatically update the project code on Jenkins, and then follow the Jenkins Project code pom.xml file to fight the war package.