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

Tuesday, October 18, 2016

Install-Configure Jenkins for ADF/Java/J2EE Application

Jenkins, is the most successful and widely used tool used for continuous integration.

Over next couple of tutorials i intend to help the developer working in various framework to use Jenkins in their application and align with industry standards.

Lets get started.

1. Download the Jenkins war from here

Note: the mentioned tutorial is specifically build on the this version of the jenkins, so please use this war for set up.

2. once the war is downloaded, go the the directory where the war is placed in command prompt

suppose the "jenkins.war" is placed in C:\Softwares\jenkins, in command prompt:

3. Run the following command:

java -jar jenkins.war --httpPort=9090

usually the port 8080 is busy so making the jenkins run on 9090

This command will create a folder named .jenkins in c:\user\<user_name> folder where all the configuration would be saved.
In case you want to start all over your jenkins, delete the folder .jenkins and start from step 3

the screen would prompt something like:


4. log on to http://localhost:9090/

screen will prompt to:


Since the jenkins is started for the first time, you must unlock the jenkins first, create admin user and proceed further

as suggested, the password can be found @ C:\Users\<user_name>\.jenkins\secrets\initialAdminPassword


5. proceeding further screen would be like this:




select "Install Suggested Pluing".


Next screen would be like:



6. Now the system prompts to create Admin user


After creating user, you may start using the jenkins

It will be available @ http://localhost:9090/


7. Once you close the command prompt, you will always have to start the jenkins using the java -jar option as suggested in step 3, but it would save the admin and other settings as long as .jenkins file is not deleted from user folder

you can also run the jenkins war on some local tomcat server.


Starting next tutorial, i will explain the Configuration of Jenkins to build the projects