How include required gradle project into another project

Here I will tell you how to include the required gradle project into another project. Situation may occur when you need to have dependency of another gradle project into your current gradle project, but neither of these projects is a multi-module project. So in this case you can easily add the required project into your current working project. To include another gradle project you need to edit the settings.gradle file of the current project. In the current project’s settings.gradle file, you have to add the project’s name which you want…

Continue

How to create Jenkins Pipeline for Java Project

Introduction Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers. Jenkins Pipeline provides an extensible set of tools for modeling simple-to-complex delivery pipelines “as code”. The definition of a Jenkins Pipeline is typically written into a text file (called a Jenkinsfile) which in turn is checked into a project’s source control repository.

Continue

How to exclude Junit tests using Gradle or Maven in Java Applications

Introduction Here in this tutorial I will tell you how to exclude Junit test cases from build automation in Java applications. It’s not about skipping test cases but it’s about excluding test cases for a particular package. Situations may arise when you want to exclude some Junit test cases from running in some environments (for example, uat, prod, etc.) while you are building your Java based application using gradle or maven build tool. For example, you don’t want to run your Junit tests related to Mosquitto or Mqtt in Jenkins…

Continue

How to create executable jar using Gradle or Maven in Spring Boot Application

Introduction In this tutorial I will tell you how to create executable jar using gradle or maven build tool in Spring Boot application. Generally maven or gradle tool is used in Java applications to automate the build process. I will also see how to control the target jar name with version appended into it. Spring Boot provides lots of benefits and one of the benefits is that you can make an executable jar out of web application.

Continue

Managing Dependencies and Plugins in Multi Module Project

Introduction Here I will discuss how to manage dependencies and plugins in multi module project using maven. A multi-module project is built from a parent pom that manages a group of sub-modules. In most of the cases, the parent pom is located in the parent project’s root directory and must have packaging of type pom. So in multi module project you need to put the required dependencies into the parent module’s pom file and child modules will inherit those dependencies from the parent pom.

Continue

Maven profile and non-profile based plugin execution

Introduction Here you will see maven profile and non-profile based plugin execution. Situation may occur when you need to execute plugin(s) for different profile(s) and plugin(s) which do not need any profile for your application. For example, let’s say you want to copy some configuration files into some specific location for local environment where your application will be deployed and run locally. We also need to replace the tokens in XML configuration files for application when it runs locally.

Continue

Maven filtering replace multiple tokens during build

Introduction In this post we will discuss about replacing the multiple tokens in XML file using maven-resources-plugin. Situation may occur where you need to replace some place holders in the XML file during build of your application and need to create a zip file under the target directory, then you may use this example as a reference. Such XML files or zip file may be required for configuring the application or project. We will use here maven-assembly-plugin to build the zip file under target directory.

Continue

Creating ZIP for Dependencies using Maven Assembly Plugin

Introduction This post is about creating zip for dependencies using maven assembly plugin. Sometimes you may need to create a zip from your application with dependencies only, i.e., to include only the jar libraries which are being used for your application. Then this tutorial will help you to understand how to create such zip file for jar libraries. Generally this kind of situation occurs in multi module project or for the single project also you may need to create zip file separately with jars only and such zip file is…

Continue

Create Zip File using Maven Assembly Plugin

Introduction Here you will see how to create zip file using maven build tool with the help of maven-assembly-plugin. Situation may occur while one of the multi-modules project may have a module with only some configuration files, such as, shell scripts, XMLs, properties or any other files that basically do not produce a meaningful jar file, because this sub-module project does not have any Java source file. So in such case it is better to build as a zip archive and such zip file is used for configuration purpose for…

Continue

Prevent JAR Creation using Maven

Introduction In this post you will see how to prevent JAR creation using maven build tool if your application does not have the required Java classes or resource files. I will use maven-jar-plugin which is used by default by maven build tool to create a JAR file. For example, you will not basically let your maven tool to create a JAR file or you don’t want to create JAR file for your application when your application doesn’t have any resources and in this case you want to prevent your build…

Continue