Wednesday, October 19, 2016

Install-Configure Jenkins for ADF/Java/J2EE Application - Part 2

In the last post, i explained how to install, the jenkins with Admin Console.

This post deals mainly with configuring the jenkins to build projects.

I have split this post in 2 Sections, Section A explains the settings one shall perform in Jenkins Global settings, Section B will explain how to create a new item that would checkout the code from svn and prepare the jar/war files.


Section A: Manage Jenkins Settings

1. Set up JDK:
     Go to Manage Jenkins -- > Global Tool Configuration -- > JDK(Click on JDK installation)


    Set the JAVA_HOME property pointing to your JAVA_HOME as shown below

2. Set up Ant: I am building my projects using Ant build so i need to define the ANT properties for the Jenkins to use.

In the same section, if you scroll below, you can see ANT
Go to Manage Jenkins -- > Global Tool Configuration -- > ANT(Click on ANT installation) and set the ANT Properties as shown below


3. Set up Emails: In this example, i intend to send out email to list or recipients with build details every time a build activity happens. So i have configured the properties for the same

Go to Manage Jenkins -- > Configure System -- > Extended E-mail Notification


and update  following details



Your jenkins Setup is complete now.

Section B: Setting up project to be built using Jenkins

In this section i would try to Setup a project build in  Jenkins

1.Click on new Item in the top left of the screen:

2. The next screen would be something like:

Enter the project Name, select freestyle project and click OK in the bottom to go to the next screen

3. The Screen would look like following:

we need to update the required section from here

4.Go to General -- > Advance and update the following

This would instruct the Jenkins to checkout the code from svn to mentioned location

5. Go to Source Code Management and update the source code location with following details.

Note: you may add the credentials for subversion during 1st time
click on add(next to credentials)

6. Go to Build Environment and select "Delete workspace before build starts" so that everytime is build is requested fresh checkout happens

7. Go to Build Section, select invoke Ant (since in this example we are using Ant to create deployable artifact)


The svn path mentioned in step 5, shall have a build.xml and the target user wants to execute shall be mentioned in Ant Steps as following:

Note : Ant version was defined in Section A step 2

8. In the post build Action i need to send out an email to the recipients with the build update so add Editable Email Notification in Post build update as



Go to the advanced settings


Add a trigger as Always send email to recipient list


9. Your jenkins is ready now.
Select the project from home page and click on Build now.



The build would be ready in the local folder where the code is checked out  and as suggested in the build.xml file



The explanation is a bit lengthy but please post your questions in comment section in case you have any doubt, and i will try to answer the questions if any

3 comments: