Springboot Applications automation using Jenkins

09 / Dec / 2015 by Prakashul . 1 comments

Building compressed files of Springboot application is a tedious task and its continuous deployment using Jenkins is even more so. To simplify the above predicament, a new Gradle plugin in Jenkins has been used. So, our objective in this blog  is to make use of the relation between Gradle and Springboot. Let us take it further.

Primarily, the GRADLE tool for building a basic Springboot application was used using Jenkins as a tool for continuous Integration. Firstly, the GRADLE PLUGIN in Jenkins was added. This was performed using the below flow of steps:

[shell]Jenkins >> Manage Plugins >> Search for "Gradle" in the "Available" tab.>> Select "Install without restart"[/shell]

After the Plugin was successfully installed, a JOB was created and the GIT repository was defined as the SCM. Next, In the Build section the “Invoke Gradle Script” option was selected.

In this section, the various switches, tasks and also the “build.gradle” file, in the case of  a separate build file, were defined.

By defining a separate “build.gradle”, custom tasks can be added or the output compressed files such as jar or war are customized. A separate build.gradle file is used if one wants to use the same build file for multiple integrations in different Jenkins Jobs. Let’s say we want to overwrite a certain parameter in the build file:

[js]jar {
baseName = ‘Mynewapp’
version = ‘1.0’
}[/js]

If it was required to get the output jar file as test-1.0.jar , it could be passed  as an argument while the gradle plugin in Jenkins was invoked.

rsz_jenkins

By the usage of  the -P switch i.e project properties, the parameter that is to be passed can be overwritten in place of the current parameter. Thus, the output jar file as test-1.0.jar was obtained.

Save the Jenkins job and then build to get the desired results. The build console output was noted as:

jenk2

The build resulted in a .jar file as test-1.0.jar that one could run easily using java along with the various JAVA_OPTIONS through the command line.

FOUND THIS USEFUL? SHARE IT

comments (1 “Springboot Applications automation using Jenkins”)

Leave a Reply

Your email address will not be published. Required fields are marked *