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

How to configure Hudson+Ant+SVN+Tomcat

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Xiaobian to share with you how Hudson+Ant+SVN+Tomcat configuration, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

I. Configuration background:

To introduce Hudson, start with Continuous Integration. Continuous integration, the first time I knew about this concept was from a book called Continuous Integration in. NET, but I was familiar with Java, not the. Net platform, so this book was put down without careful reading. Now, we needed to develop a knowledge management platform using SSH architecture, and the project leader tasked me with configuring the development environment for continuous integration.

It seems that I am a bit off topic after saying this for a long time, or I haven't said what continuous integration is. Continuous integration is a software development practice in which team members integrate their work frequently, usually at least once a day for each member, meaning that integration may occur multiple times a day. Each integration is verified through automated builds (including compilation, release, automated testing) to detect integration errors as quickly as possible. Many teams have found that this process greatly reduces integration problems, allowing teams to develop cohesive software faster.

The above definition comes from software guru Martin Fowler, a guru is a guru, I don't understand anyway. Let me explain my understanding. Here, let me give you an example...

Now that we've done the preliminary work (requirements identification, prototype design, etc.), it's time to start programming. We rarely work alone now, do we? Most of the members of the group cooperate to write the system. In this way, there is a problem. There may be a gap in everyone's programming environment. After compiling and running everyone's code collection, you may encounter different versions of the class library used or different times for submitting code. As a result, the previous submitting personnel have to wait for other comrades to complete the compilation of the code before they can integrate the compilation test together. If the computer can automatically continue the loop, if there is a new code base update, It will automatically integrate and then test, which will save us a lot of time. Continuous integration is what it looks like to me. I don't know if I'm clear?!

II. Configuration tools:

As the saying goes, if you want to do a good job, you must first use your tools. Let's look at the tools we need:

Hudson: Hudson.war

Java: jdk1.6.0_07

Ant : apache-ant-1.8.1

Tomcat: apache-tomcat-6.0.29.txt.exe

SVN: VisualSVN-Server-2.1.5(SVN Server).msi

TortoiseSVN-1.6.10.19898-win32-svn-1.6.12.msi (SVN client)

First, continuous integration tools, now more common continuous integration tools:

Cruise Control: Open source, built around Ant. Commonly used, but users often report that it is difficult to configure and needs to write configuration files. Cruise Control is also known as the "original"CI tool for Java.

Apache Continuum: Open source, used to build Java projects. Since it is the official build tool for Maven, it tends to provide excellent support and experience for Maven based projects. Its management and configuration is done through a web-based interface.

JetBrains Team City -A popular commercial CI server. A unique feature of Team City is that it has plug-ins for several IDEs that allow developers to "pre-test" commit their changes to the version control system-using this feature means it is impossible for developers to "break the build of the program." Its management and configuration is done through a web-based interface.

Here is an example of Hudson, which I've been working on for two days, although other continuous integration tools can be used. Configuration usage is beyond the scope of this article.

Java JDK doesn't say much.

Ant's famous java build tool.

Tomcat is the most used Apache server.

SVN replaces CVS as the now popular version control tool.

Because testing on this machine requires the use of svn server, VisualSVN is selected here as the server side of SVN, SVN 1.4.5 can also be used as the server, but you need to use the command line in the console to control, TortoiseSVN as the SVN client tool, the image of the little turtle has been deeply rooted in the hearts of the people.

Up there, our tools are ready and we're ready to configure.

III. Configuration steps:

The first is Java jdk installation, if I remember correctly, Java jdk installation environment variables should have been configured.

Ant configuration:

After downloading ant, it should be a compressed package. After decompression, the path after decompression is replaced with ${ant_path} here. Open the system environment variable and create a new ANT_HOME variable with a value of ${ant_path}. Then add the following to the system variable path:

;%ANT_HOME%\bin;%ANT_HOME%\lib;

Ant configuration is complete.

Install Tomcat, if your tomcat is an exe file, install it directly, otherwise, extract the compressed package to a path, I use ${tomcat_path} instead. Open the system environment variable as above and create a CATALINA_HOME variable with the value ${tomcat_path}.

Add the following code to the path variable:

;% CATALINA_HOME%\bin;

Add the following code to the classpath variable:

; % CATALINA_HOME%\lib;

Then, go to the bin folder under ${tomcat_path} and there is a startup.bat (for windows series systems) or startup.sh(for unix series systems). If it is installed using exe, the tomcat server is started in the service under system administration. At this point tomcat is configured and started.

We use Hudson.war, the original java web development can be seen at a glance, this thing can be thrown into tomcat webapps to run, we do so.

Open your browser and enter the following address:

http://localhost:8080/

This is the legendary kitten, see it means that our tomcat has been successfully installed, and has started. Now we copy Hudson.war to the ${tomcat_path}/webapps folder. Enter the following address in your browser:

http://localhost:8080/hudson

If you succeed in getting the following page:

You can see here that I deployed two projects.

*** Steps to configure Hudson:

Select System Settings.

The following page appears:

Select System Settings. The following page appears:

The path in the figure describes the directory where Hudson generates the project output. This can be changed to a directory we are familiar with, but I will not change it here.

Here is the JDK configuration:

Since multiple jdks can be configured in hudson, I'll first give this jdk an alias to identify different jdks, so I'll choose java_jdk. Enter the JAVA_HOME variable value in the JAVA_HOME environment variable below. We can add different jdks by clicking on the new jdk button.

Here is Ant's configuration:

Similar to jdk configuration process, give ant path, alias ant.

Here is the maven configuration:

Because this article does not cover maven configuration procedures.

Here is the version control tool configuration:

Since we are using svn, the cvs column can be left blank, and the svn version to use can be configured in subversion below. I am using svn 1.6. So choose the option shown above.

Another useful feature is this email alert feature, as shown in the following figure. This feature is prepared for development teams with email servers. When there is a change in the program code jointly maintained, it will automatically send notification emails. Hudson looks pretty good.

Here is how to configure the svn server on the local machine. We use VisualSVN here. Because VisualSVN uses interface configuration, it is much easier than SVN 1.4.5. After installation, you will see the following interface:

Prove that your VisualSVN has been started, first you have to have an identity, first create a user under User, and then create your own repository under Repositories on the left, such as we named Demo here.

Here is how to install SVN client--TortoiseSVN.

Then we construct a java web project, tools can be arbitrary, Eclipse, MyEclipse can be.

I used MyEclipse to build a project called test. Its structure is as follows:

The simplest web project. Just build it. Go to the directory where the test project is located and create a build.xml file, as shown in the following figure.

The build.xml file is a configuration file for building with ant, as described in my upcoming blog post,"Simple configuration of build.xml file in ant."

Here are the contents of my build.xml file attached:

Now we upload our test project to svn server.

Select the repository we just created on svn server.

Click ok button, wait for upload success and close upload window. Now we can create a new build project in Hudson. Open a browser, type http://localhost:8080/hudson to open Hudson's home page, select Build a free-style software project, and name the project, here testDemo.

After clicking OK, enter the project configuration interface, the most important of which is Source Code Management. After selecting Subversion, there will be an expansion as shown below.

Fill in the Repository URL we just passed on the project address, I here is the following:

https://arkiarx/svn/demo

Below we also specify that we want to use ant.

Click the add build step button and select Invoke Ant to get the following expansion:

Select the ant configured in our hudson.

At this point the configuration process for the simple project is complete.

IV. Test configuration:

After the configuration is complete, the following steps are very simple, that is, to test whether the process of this configuration is correct.

Select the project we just created to build immediately. If we build it successfully, we can get the following page:

It means the integration is successful. In the command line output on the left we can get a list of the products ant gets in this build and download them. You can also look it up in hudson's configuration output directory.

The above is "Hudson+Ant+SVN+Tomcat how to configure" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

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

Development

Wechat

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

12
Report