Jenkins + Maven + SVN + tomcat7 cluster deployment (2)

Source: Internet
Author: User

Article 2 focuses on installing SVN and integrating Jenkins

If you use yum for installation, the latest version of SVN is not easy to use. You can directly use Yum install subversion.

Configure the svn configuration first. First, create a repository.

Mkdir/home/SVN

Svnadmin create/home/SVN/ceit

CD/home/SVN/ceit/Conf

The conf folder contains some SVN configurations. You can configure some members and project team members here. Previously, I created a repository called ceit, then I mainly configure the user of this repository, which contains the following files: authz passwd svnserve. conf: Configure user permissions, user account and password, and SVN configuration information respectively. First, Configure permissions first.



I configured a user named wk here [/], which indicates that all permissions in all paths are readable and writable. You can enter the permissions as needed and save the changes, then add a user to the passwd file.





I added a user named wk, corresponding to the user in the permission configuration file, and the password is the attribute after the equal sign. Please note that no space is enough for both the front and back.

After saving it, you will be done, and then start your repository service. According to the path I configured, it is

Svnserve-d-r/home/SVN/ceit

The SVN service is started at this time.

# Check whether SVN has been started. If data is displayed, it indicates that SVN has been started.

PS-Ef | grep SVN

# This command disables SVN and displays the process number according to the preceding command.

Kill-Quit process number

This is the end of the process.

The next step is the integration of SVN and Jenkins.

First, make sure that you install these plug-ins. If not, click the optional plug-ins above to install them.


This is the maven plug-in.


This is mainly a plug-in for deployment.




SVN plugin



After the above plug-ins are installed successfully, proceed to the next step and install Maven in Jenkins. This Maven can be installed in Jenkins.


Choose System Management> system settings. Find Maven and click Maven to install it,




Basically, you can enter a name. You can enter the name at will, select "auto install", and select "version". These steps are required. Then click "save" below. It must be strange to everyone, can this be used? Will it be easy to implement? In fact, Maven is only a configuration here and will be automatically downloaded during project construction, so it is best to ensure that your network is smooth When configuring Jenkins. Otherwise, unexpected errors may occur.

.


Now let's start building the entire project. First, you should create a new Maven project on your windows computer and upload it to SVN using tools on the window, for a lot of tutorials on the internet, let's take my project for example. My project name is spring, and my SVN path is SVN: // 192.168.70.128/SVN/ceit/spring, and integration starts.

Step 1:

On the homepage, click Create project.



Follow the steps of the book and click OK.

Configure the svn URL and user, fill in the svn project path, and click the Add button to add the account password. Here, the account password is the one we configured in SVN, Which is wk and the password is 123.



Check the corresponding operations. You should know what it is in English. I will not explain it much.




In the last step, add container support. Here I use Tomcat 7. Click Add build and select deploy war/ear to a container. Then click Add container and select tomcat7.



Then fill in the corresponding information. Note that the context path is the name of the war package generated. If it is/, it is root. war now generates spring. war. For target/spring. enter war according to the name of the war package generated by Maven, but the target must be added before the path; otherwise, the build will fail. It does not produce any errors or deploy the project to Tomcat. Note that,



Then you need to configure and manage user information in Tomcat. You can also copy the information based on my files.

<?xml version='1.0' encoding='utf-8'?><!--  Licensed to the Apache Software Foundation (ASF) under one or more  contributor license agreements.  See the NOTICE file distributed with  this work for additional information regarding copyright ownership.  The ASF licenses this file to You under the Apache License, Version 2.0  (the "License"); you may not use this file except in compliance with  the License.  You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and  limitations under the License.--><tomcat-users><!--  NOTE:  By default, no user is included in the "manager-gui" role required  to operate the "/manager/html" web application.  If you wish to use this app,  you must define such a user - the username and password are arbitrary.--><!--  NOTE:  The sample user and role entries below are wrapped in a comment  and thus are ignored when reading this file. Do not forget to remove  <!.. ..> that surrounds them.--><role rolename="tomcat"/>  <role rolename="role1"/>  <role rolename="manager-gui"/>  <role rolename="manager-script"/>  <role rolename="manager-jmx"/>  <role rolename="manager"/>  <role rolename="manager-status"/>  <user username="tomcat" password="tomcat" roles="tomcat"/>  <user username="both" password="tomcat" roles="tomcat,role1"/>  <user username="role1" password="tomcat" roles="role1"/>  <user username="admin" password="admin" roles="manager,manager-gui,manager-script,manager-jmx,manager-status"/></tomcat-users>

Here we use the admin user. The password is the password we have configured.

After everything is configured, click Save, and then go to the home page. You will see your project, click in, and click build.



Click the console output on the left side to view the build log, and emphasize the following,

tomcatManager status code:403, ReasonPhrase:Forbidden
When you see this error, You need to perform a two-step check. First, check whether your Tomcat user's permissions are configured the same as mine. Second, you need to configure the maven Tomcat plug-in.


 <plugin>                <groupId>org.apache.tomcat.maven</groupId>                <artifactId>tomcat7-maven-plugin</artifactId>                <version>2.1</version>                <configuration>                    <port>8081</port>                    <url>http://192.168.70.128:8081/manager/text</url>                    <server>tomcat</server>                    <update>true</update>                    <username>admin</username>                    <password>admin</password>                </configuration>            </plugin>
Note that the above url6 and 7 are different.

If 401 occurs, it indicates that your user does not exist.

If everything is successful, congratulations! It's almost over now. I will talk about it in the next article, tomcat cluster and nginx management almost build the entire cluster environment and cluster 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.