Tuesday 8 March 2022

Install Ant plugin and integrate it with Jenkins


Tools: Git, GitHub, and Jenkins


1. Create a GitHub repository 

Create a new repository ➡ Repository Name ➡ Public ➡ Add a README file ➡ create repository

Code ➡ HTTPS ➡ https://<url> ➡ copy


2. Add build.xml file to the repository

#open terminal

git clone https://<url>

cd Demo-Ant/

vim build.xml

<?xml version="1.0"?>

<project name="Hello World Project" default="info">

<target name="info">

<echo> Hello World - Demo Ant</echo>

</target>

</project>


git init

git add build.xml

git commit -m "Add build file"

git remote -v

git push -u origin main


3. Set the Global Tool Configuration


Jenkins ➡ Manage Jenkins ➡ Global Tool Configuration


Ant-

Ant installations  

Add Ant

Ant

Name

[FirstAnt]

Install automatically

Install from Apache

Version

List of Ant installations on this system

Apply ➡ Save


4. Integrate Ant with Jenkins

Jenkins ➡ New Item ➡ Enter an item name ➡ Freestyle project ➡ OK

Source Code Management ➡ Git ➡ Repository URL[https://<url>] ➡ Branch Specifier[*/main]

Build ➡ Add build step ➡ Invoke Ant ➡ Ant Version[FirstAnt]

Apply ➡ Save


Build Now ➡ Build History ➡ Console Output


No comments:

Post a Comment