Jenkins Maven job Configuration

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

Maven provides developers ways to manage Builds, Documentation, Reporting, Dependencies, SCMs, Releases, Distribution, and mailing list.

The POM.xml contains information about the project and various configuration detail used by Maven to build the project(s).

 

1. Prerequisites

  • Start the Jenkins java -jar jenkins.war and open the homepage localhost:8080 for example
  • Start the Tomact Server with admin rights and open the homepage localhost:9080 for example
  • Goto Manage Jenkins →Manage Plugins → Add Deploy Plugin , Maven Project Plugin,
  • Goto Manage Jenkins →Global Tool Configuration→ Add JDK & Maven

Now we are ready to move on

 

2. Steps to create Maven Build Job in Jenkins

1.Select New Item on the left side menu

2.Choose Maven Project& provide item name then click on OK

 

3.Next window it will show the Job properties. On the Build tab provide Pom & goal details

 

4.On the Build tab []Check Custom workspace & provide project root directory location details then APPLY

 

5.On the PostBuild Actions tab Choose Deploy War/Rar to a Container & provide details

 

6.Now we setup everything. Just click on Build Now. We can check the status by clicking Status

 

7.we can see the Console output by clicking Console Output menu item

 

8.Now open Apache Tomcat server with admin rights, we can see the .war file is deployed automatically in the server