You will need to configure Maven as a global build tool.
In the Jenkins web interface, go to:
Manage Jenkins
-> Tools
-> Maven installations
-> Add Maven
.
Give your Maven installation a name and check the option to Install automatically
.
Select the Save
button.
Create a freestyle job and configure it as follows:
- Under
Source Code Management
, selectGit
and enter the following URL:
https://github.com/LinkedInLearning/learning-jenkins-3003221
- MAKE SURE TO SET THE
Branch Specifier
to*/03_01
. - Add a build step using
Invoke Top-Level Maven Target
. - Select the Maven version you configured in the previous step.
- For the goal, enter
package
.
Select Add build step
-> Execute Windows batch command
.
Enter:
java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App
Save the job and start the build.
Follow this link for more details on Windows
Select Add build step
-> Execute shell
.
Enter:
java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App
Save the job and start the build.
Follow this link for more details on MacOS, Linux, and Docker
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
This error means you have probably entered the wrong branch under Source Code Management. You need to enter */03_01
for the branch.