This is another example of a freestyle job/project in Jenkins which will use a simple Java project from the GitHub repository.
Step 1. Login in Jenkins
First, you need to login into Jenkins with the credentials that you have used while installing Jenkins.
Step 2. Create a New Item
Click on the “New Item” at the top left of the Jenkins dashboard.
Step 3. Provide Item details
✔ Enter the name of the project.
✔ Choose Freestyle Project.
✔ Click Ok at the bottom
Step 4. Enter the Project Details
Enter some description about the project.
Step 5. Enter the repository URL in the SCM section.
Use this repository for this freestyle job: https://github.com/dwops-git/javaDemo
Step 6. Execute Shell in Build step
Now, go to the build step and select Execute Shell.
Step 7. Enter the Commands for Java Build
Use the following commands to build the Java project:
javac HelloWorld.java java HelloWorld
Step 8. Apply and Save the Project.
Step 9. Build the Project and see the output
Click on the Build now button to build the project. Now, go to build history and click on the latest build number.
Open console output to see the logs output.
✔ Create a freestyle Job that will able to clone the code from GitHub/GitLab.
✔ Using HTTPS protocol
✔ Using SSH protocol
✔ Update the above Jenkins job so that it can detect whether there has been a code commit in the last 5 minutes and will get triggered.
✔ Make the Console output colored.