bmuschko Docker Gradle plugin review

If you just want to build Docker images within your Gradle project then it might frustrate you to have to decide which plugin to use. At the time of writing, there were 149 plugins listed on the Gradle plugin portal matching the search term Docker. Whilst I can’t make the choice for you, this article will help you get to a decision, with a review of the bmuschko Docker Gradle plugin....

Published 15 Jun 2021 · 10 min read · Tom Gregory

Top Gradle 7 features & improvements

Gradle 7.0 was released on 9th April 2021, and includes some important new features and improvements. Discover what’s new, and what the benefits could be for your Gradle project. New features/improvements in Gradle 7 Java toolchain support What is it? Gradle’s new Java toolchain allows you to use different versions of Java for different parts of your build. By default, Gradle uses the same Java version to compile and run your application as the version you’re using to run Gradle itself....

Published 16 Apr 2021 · 7 min read · Tom Gregory

SonarQube branch analysis

SonarQube helps us improve code quality using static analysis techniques. You can even add quality gates to fail your CI pipeline if the master branch doesn’t meet your requirements. Why not also apply the same technique to feature branches? In this article you’ll learn how to setup SonarQube branch analysis to check the quality of both master and feature branches, finding potential issues even earlier in the development lifecycle. SonarQube branch analysis version compatibility SonarQube branch analysis is only available for specific editions of SonarQube....

Published 5 Apr 2021 · 6 min read · Tom Gregory

View the Gradle Dependency Tree

In Gradle dependencies are libraries required to build your code. Each of these libraries may have their own dependencies, adding transitive dependencies to your project. This structure is called the Gradle dependency tree, with its own rules on dependency conflict resolution and more. In this article you’ll learn how to view the dependency tree, so you can understand fully how you project is built and resolve common issues. Dependencies and dependency configurations To be able to properly navigate the Gradle dependency tree, it’s important to understand how dependencies can be configured within different configurations....

Published 29 Mar 2021 · 7 min read · Tom Gregory

All about the Gradle task graph

A powerful feature of the Gradle build tool is its ability to setup dependencies between tasks, creating a task graph or tree. The task graph means you only need to run the task you care about, and any other required tasks get run automatically. In this article, you’ll learn all about the Gradle task graph, how to add tasks to it, and how to print it out. Tasks and task dependencies A Gradle task is a unit of work which needs to get done in your build....

Published 22 Mar 2021 · 7 min read · Tom Gregory

gradle vs. gradlew - what's the difference?

One of the most common questions for anyone using Gradle is what’s the difference between gradle vs. gradlew. Each is a Gradle command with a particular use case in mind. Here you’ll learn what each command does, and when to use one over the other. Quick summary If you’re working in a project that has a gradlew script, always use it. If it doesn’t, use the gradle command to generate it....

Published 6 Feb 2021 · 4 min read · Tom Gregory

Anatomy of a Gradle build script: the key to understanding Gradle

Did you ever look at a Gradle build script and end up scratching your head? Even the simple ones can be tricky to understand if you don’t know the basic building blocks of the build.gradle file, the Gradle build script. To better understand Gradle, it’s helpful to know that the build script normally consists of nothing more than the following components. 1. Plugins Plugins are Gradle-specific bundles of functionality to enhance how it runs your build....

Published 11 Sep 2020 · 4 min read · Tom Gregory

Annotation Processors in Gradle with the annotationProcessor Dependency Configuration

Annotation processing is a Java compilation option which has been around since Java 5. It enables the generation of additional files during compilation, such as classes or documentation. Gradle abstracts the complexity of passing the correct compilation options to Java with the annotationProcessor dependency configuration, which we’ll explore in detail in this article with a full working example. An example of a popular annotation processor we’ll look at today is mapstruct, which automatically generates mapper classes to map data between Java data objects....

Published 26 Jun 2020 · 5 min read · Tom Gregory

How to update Gradle

Using the Gradle wrapper means that a project can be fixed to a specific version of Gradle. If you want to update Gradle to a newer version though, follow the simple steps in this article. What’s my current Gradle version? Assuming your project is using the Gradle wrapper, which it most likely is, run ./gradlew --version: $ ./gradlew --version ------------------------------------------------------------ Gradle 6.4.1 ------------------------------------------------------------ Build time: 2020-05-15 19:43:40 UTC Revision: 1a04183c502614b5c80e33d603074e0b4a2777c5 Kotlin: 1....

Published 17 Jun 2020 · 3 min read · Tom Gregory