🛠️Build Jenkins First Job
In this section we will create a Job and Jenkins will provide us with the build file.
Last updated
In this section we will create a Job and Jenkins will provide us with the build file.
Last updated
Click on create new jobs:
Enter the item name, select job type and click OK. We shall create a Freestyle project as an example.
Once you click OK, the page will be redirected to its project form. Here you will need to enter the project information:
You will see a Git option under Source Code Management if your Git plugin has been installed in Jenkins:
Enter the Git repository URL to pull the code from GitHub.
Scroll Down and click on Add Build Step >> Invoke top-level Maven Targets:
In the Goal section type " test install
" maven command this command is used to test and create a build file.
APPLY and SAVE.
Now we need to provide paths for JAVA, Maven and Git to jenkins:
Go to Jenkins Dashboard
Manage Jenkins >> Global Tool Configuration
You will see window like this
Here we have to provide path for JDK, Git and Maven(scroll down )
Click on ADD JDK >> untick install automatically (because we have already downloaded it we just need to give the path) Login to EC2 shell and type the following commands
(Note down the name of Maven you entered you have to change it in Build step section where we wrote "test install" command)
Apply & save
Before we click build now we need to do small task. Navigate to JENKINS Dashboard and select your job >> Configure >> scroll down >> Select the Maven name you entered in previous secton
Now click on Build now and see the console output
If you Success. Congratulations, Jenkins has successfully created .war
file we can see the file in the destination provided in console out lets check it.
As you can see we have the webapp.war (build file) Now we need to deploy this on Tomcat Server which we will host on another EC2 server with Docker Containers 🐳
Apply and Save