Jenkins: How to Create Builds with the Jenkins Freestyle Project

Sunday, January 26, 2020

Jenkins: How to Create Builds with the Jenkins Freestyle Project


A Jenkins freestyle project is a repeatable build made up of build steps and post-build actions. You choose what runs at each stage, and there are dozens of standard plugins available to extend it. This blog walks through creating a freestyle job from scratch, pointing it at a Git repository, compiling a Java program, and checking the console output.

Jenkins create and build freestyle project
Jenkins create & build freestyle project

The below topics are covered in this blog -

1) What is a freestyle project in Jenkins?
2) Creating a new freestyle build job
3) Configuring source code management with Git
4) Adding a build step
5) Running the build and reading the console output

1. Freestyle Project in Jenkins

A Jenkins project consists of build steps and post-build actions. The actions you can perform fall into three places: the build step, the post-build action, or a Jenkins pipeline. There are a large number of standard plugins available to cover most common requirements.

2. Creating a Freestyle Build Job

To create a Jenkins freestyle job, log in to your Jenkins dashboard. If Jenkins is hosted locally, visit http://localhost:8080. If it is hosted elsewhere, use that URL instead.

Step 1

Click New Item in the top left corner of your dashboard.

Jenkins New Item menu option on the dashboard
Jenkins New Item

Step 2

Enter the name of the item, choose Freestyle project, and click OK.

Selecting Freestyle project when creating a new Jenkins item
Freestyle Project

Step 3

Enter the details of the project you want to set up.

Entering Jenkins freestyle project details
Jenkins Project Details

Step 4

Under Source Code Management, enter your repository URL so Jenkins can clone it. For this example the URL is:

https://github.com/kriru/firstJava.git
Configuring the Git repository URL in Jenkins source code management
Jenkins Setup Git Project

Step 5

Click Add build step → Execute Windows batch command and add the commands you want to run. In our case:

javac HelloWorld.java
java HelloWorld

On a Linux or macOS agent, use Execute shell instead of Execute Windows batch command — the two commands themselves stay the same.

Adding an Execute Windows batch command build step in Jenkins
Jenkins Build Windows Batch Command

Step 6

Click Apply & Save, then Build Now to check whether the build succeeds.

Triggering a Jenkins build with Build Now
Jenkins Build Now
Jenkins build successful status on the project page
Jenkins Build Successful

Step 7

If you want to explore further, click Console Output to see the detailed result.

Jenkins console output showing the completed build log
Jenkins Console Output

Congratulations — we have executed our HelloWorld program from Jenkins.

3. Video Walkthrough


About the Author
Atique Ahmed — Principal AI Architect. 7x Microsoft MVP and Guinness World Record holder for Programming Excellence. Founder of Codez Tech.
Portfolio  |  LinkedIn  |  GitHub

3 comments :

Pigiga said...

Following BahrainMagazine has enriched my understanding of current events and technology. The website consistently balances local news with global perspectives, offering a seamless reading experience that is both informative and engaging.

Pigiga said...

By providing well-researched content, SaudiArabiaMagazine ensures its audience receives timely news, thoughtful technology coverage, and practical business insights, making it an essential resource for professionals and enthusiasts alike.

Pigiga said...

Every visit to MyBusinessTimes brings value, as it combines timely updates with expert insights, offering readers relevant business news, market trends, and technology breakthroughs that matter in today’s competitive landscape.