Jenkins Basics -10-Create a new Jenkins Job__jenkins to execute Java programs

Source: Internet
Author: User

This article describes how to create a job on the Jenkins to execute Java programs. This Java program, we only write a simple program, a Hello.java file to represent our Java program, by understanding the entire creation process, to imitate the actual work of a Java project on the Jenkins build process.

1. Write a Hello.java with Notepad, code as follows

public class hello{public
	
	static void Main (string[] args) {for
		
		(int i=1;i<=10;i++)
			System.out.println ( "Hello World" + i);
	}
	
Create a new folder on your desktop and put the Hello.java in the folder.

2. There is no problem with the program just written in the CMD compilation test

3. Create a Hello project on the Jenkins

4. Build command

Select Windows Batch Commond, enter the following command, click Save

It is recommended that you write an absolute path behind the first CD command, otherwise error prone.

5. Start building, test

Summarize:

I have used this example to perform my WebUI automated test script run. If you are a java+selenium, then you only need to use the batch command to execute testng.xml files. is not, so if your script is not managed with the source tools, you are a small project of one person, you can go to play like this. We'll just have to play this pattern before we think about how we're going to do it if there's a code management tool, so next we'll explain how to create a Jenkins project build on the current basis, introducing Git or SVN.

Related Article

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.