Gradle tips and insights for Java developers

Spend less time fighting your build and more time developing software

Maven phases vs. goals

Do you want to fully understand the difference between Maven phases and goals, and how to execute each of them? OK, let’s start at the low-level and work our way upwards. At its core Maven is a Java build tool which takes your project from some source files and resources to a shiny jar file ready to run. The way Maven achieves this, just like anything worthwhile doing in life, is by executing some code....

Published 1 Apr 2022 · 7 min read · Tom Gregory

4 Benefits Of Using Gradle Multi-Project Builds

If your Gradle build has only a single project then you could be missing out on important benefits of multi-project builds. Splitting Gradle projects into multiple subprojects is almost always a good idea, so in this article you’ll discover the 4 benefits of using Gradle multi-projects builds to setup your project for success. Single vs. multi-project builds Before we get into the 1st benefit, let’s define what a multi-project build is and how it differs from a single-project build....

Published 1 Mar 2022 · 8 min read · Tom Gregory

How to add a Gradle dependency

Discover the best way to add a dependency to a Gradle project and understand what Gradle does to make the dependency available to your application code. Sometimes when you’re developing an application you need to use code from another library. In the below Java application built with Gradle, I want to use the StringUtils class to process the input by switching it to upper case. package com.tomgregory; import org.apache.commons.lang3.StringUtils; public class Application { public static void main(String[] args) { String processedString = StringUtils....

Published 14 Jan 2022 · 5 min read · Tom Gregory

Gradle assemble task essentials

Learn everything you’ll ever need to know about Gradle’s task for creating artifacts, assemble. Assemble is a task you run from the command line using ./gradlew assemble in Linux and Mac or gradlew assemble in Windows. To fully understand assemble you need to know about the 2 types of Gradle tasks: actionable tasks have some action(s) attached to do work in your build lifecycle tasks are workflow tasks with no actions attached Assemble is a lifecycle task with no actions attached....

Published 13 Jan 2022 · 4 min read · Tom Gregory

Gradle check task essentials

In this article you’ll discover everything you’ll ever need to know about Gradle’s verification task, check. Check is a task you run from the command line using ./gradlew check in Linux and Mac or gradlew check in Windows. To understand check, know that Gradle has 2 types of tasks: actionable tasks have some action(s) attached to do work in your build lifecycle tasks are workflow tasks with no actions attached. Check is a lifecycle task....

Published 12 Jan 2022 · 4 min read · Tom Gregory

Maven vs. Gradle in-depth comparison

This in-depth comparison helps you decide whether to use the Maven or Gradle build tool. Whatever your use case, you’ll find the answers here to quickly enable you to pick the right tool to support your project’s growth. Overview Both Maven and Gradle fall into the category of build tools. They’re designed to automate the work involved to take your application’s source code and transform it into an artifact to be published....

Published 17 Dec 2021 · 14 min read · Tom Gregory

Top 5 Gradle benefits over Maven

You might be surprised how much difference Gradle can make compared to Maven in terms of developer productivity. To show you how, here are the top 5 benefits of using Gradle, each with a full comparison with Maven. 1. Much faster Gradle is faster. A lot faster. This is a massive productivity boost to developers building projects many times each day. Let’s be specific about what faster means, by comparing Maven and Gradle’s performance in a real project....

Published 13 Dec 2021 · 9 min read · Tom Gregory

Jib vs. Spring Boot for building Docker images

Discover why using a Docker image build tool like Jib or the Spring Boot plugin is a good idea and how to set it up to build your application.

Published 30 Nov 2021 · 14 min read · Tom Gregory

How to build Gradle projects with GitHub Actions

If you have a Gradle project in GitHub, then GitHub Actions can build it automatically on push with minimal setup. And it won’t cost you a penny. While other CI solutions involve the headache of managing servers, GitHub Actions is entirely hosted on their infrastructure. In this article you’ll learn how to easily build Gradle projects with GitHub Actions, optimise build performance, and use the event driven approach to handle common scenarios like PR creation....

Published 22 Nov 2021 · 18 min read · Tom Gregory