Now comes the most important part of your Project / Job configuration, Provide accurate path of your Jenkinsfile.Ĭlick on Apply and Save. Our branch is main branch so will change master to main In SCM select Git and below it provide your Git repository URL where your project is located and Add your GitHub credentials.īy default Jenkins provide branch as Master but you can change it to dev, main, or to whatever your branch is.(if you don’t know you can check the branch by going to your GitHub repository OR by running git branch command on your shell). Now in Pipeline section click on drop down and select Pipeline script from SCM. Now we will set the Build Triggers, Select Build whenever a SNAPSHOT and GitHub hook trigger for GITScm polling as triggers. You can use Sample Java Project on GitHub with jenkinsfile Provide some description for the newly created job in General Section, Click on GitHub project and provide the GitHub URL. Enter Project details in Jenkins Pipeline Now we will create a new Pipeline Job in Jenkins, So, click on “New Item” on the Jenkins Dashboard as shown below.Įnter Job name and select “Pipeline”, Click OK. Now below click on Maven-> Add Maven, We can provide our Installed Maven path or we can also use Jenkins default one.In this case we are using Jenkins default Maven version.Ĭlick on apply and save. Navigate to Dashboard-> Manage Jenkins-> Global tool ConfigurationĬlick on JDK-> Add JDK, Give a JDK name and provide your JAVA_HOME path where the JDK is present. Now we will configure System by adding JDK and Maven installation in Jenkins. Please wait while Jenkins is restarting #3.
So now click on Restart Jenkins checkbox. Once the plugins are downloaded successfully.
Now search for “GitHub Integration Plugin” and click on Download now and install after restart. Navigate to Dashboard-> Manage Jenkins -> Manage Plugin To build Java project with maven we need to install some plugins like, Install GitHub Integration and Maven Plugins in Jenkins Jenkinsfile works as a “Pipeline as a Code”.įirst thing, we will login to our Jenkins account #2. Jenkinsfile is nothing but a simple text file which is used to write the Jenkins Pipeline and to automate the Continuous Integration process. Jenkins Pipeline is a combination of Plugins which automates number of tasks and makes the CI/CD pipeline efficient, high in quality and reliable. Build Java Project using Maven in Jenkins Pipeline Jenkinsfile to Build Java Project using Maven in Jenkins Pipeline