Configuring a Maven project for execution
Let's configure a project in with static code analysis, compilation of files, creation of the package file, and archiving it so you can use it later in another build job or project.
Getting ready
You have already created a Maven project in Jenkins in Chapter 1, Getting Started with Jenkins, in the recipe, Creating a Maven Job for a Maven project.
How to do it...
- Go to Jenkins dashboard |
Maven Project
|General Section
. - Select
Discard old builds
| ConfigureMax # of builds to keep
(to avoid too many builds and save disk space). - As the Maven template was selected at the time the build job or project was created, we only need to verify the path of
pom.xml
and then we can give package as a goal to create a package or WAR file in case of Java. - Go to
Post-build Actions
|Add post-build action
|Archive the artifacts
. - Provide the path of the war file that needs to be archived so another project can utilize the package file if required.
- Click on
Build now
. - Go to...