A build job is a basic execution unit in Jenkins. We can perform many actions using build jobs. We can execute commands, send notifications, configure Continuous Integration, and so on.
Creating a Freestyle job for Ant Project
Getting ready
You will need to configure tools based on the application, such as Ant, Gradle, Java, Git, and so on.
How to do it...
- Open the Jenkins dashboard.
- Click on New Item.
- Enter an item name.
- Select a template Freestyle project.
- Click on OK:
![](https://static.packt-cdn.com/products/9781788297943/graphics/assets/ec3ccdfe-d1a7-4135-808f-64f2f68d806b.png)
- Go to the Source Code Management section and select Git.
- Provide the Repository URL.
- Provide Credentials, as demonstrated in the next screenshot:
![](https://static.packt-cdn.com/products/9781788297943/graphics/assets/ce2f2889-70a3-4f0a-9d2d-4a4df9cfe32a.png)
- In the Build section, click on the Add build step and select Invoke Ant.
- Select the Ant name based on our Global Tool Configuration.
- Provide Targets. In Ant, we can give a target based on the targets defined in the build.xml file:
![](https://static.packt-cdn.com/products/9781788297943/graphics/assets/2a0d1347-d29a-4222-bd59-8df4b78b1f10.png)
- Click on Save.
How it works...
When you go to the Build Job page and click on Build now, it will execute the build based on the configuration.