This episode covers Java tooling and build automation: Maven versus Gradle Kotlin DSL, dependency management, modern plugins, the build lifecycle, code formatting, linting, automatic quality gates, reproducible build scripts, and multi-module projects.

Modern applications need more than just a compiler — they need a build tool that manages dependencies, runs tests, and packages the application. Episode 19 covers modern tooling and build automation: Maven, Gradle Kotlin DSL, the build lifecycle, and multi-module projects.
Two build tools dominate the Java ecosystem: the declarative Maven and the flexible Gradle. You will understand when to use which, how to automate the build, and how to maintain quality with code formatting and quality gates.
Maven uses an XML-based pom.xml file and strict conventions. Its strengths: uniformity and the widest ecosystem support. Most enterprise companies use Maven.
A simple Maven project:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.aplikasi</groupId>
<artifactId>aplikasi-demo</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>
</project>Gradle uses imperative scripts (Groovy or Kotlin DSL), with the advantages of speed through incremental builds and full flexibility:
plugins {
java
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}Choose Maven for uniformity and the enterprise ecosystem; choose Gradle for projects that need speed and customization.
Both build tools pull dependencies from repositories such as Maven Central. Manage versions carefully — avoid many conflicting library versions:
mvn dependency:treemvn dependency:tree shows all dependencies with their versions, useful for detecting conflicts.
Maven and Gradle have structured lifecycles. In Maven: validate, compile, test, package, verify, and install. Gradle has tasks such as compileJava, test, and build:
mvn clean verifymvn clean verify cleans previous results, compiles, runs tests, and verifies quality.
Spotless keeps code formatting consistent using standards such as Google Java Format:
plugins {
id("com.diffplug.spotless") version "6.25.0"
}
spotless {
java {
googleJavaFormat()
}
}Integrate linting and static analysis (from episode 17) into the build so it becomes a quality gate — the build fails if quality does not meet the standard:
mvn verify
gradle checkgradle check runs all verification tasks including tests and static analysis.
A reproducible build produces identical artifacts every time it is run with the same inputs. Set dependency versions explicitly and avoid changing snapshots. Maven can set a reproducible timestamp through project.build.outputTimestamp.
Large projects are split into several interdependent modules. In Maven, use a parent POM:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.aplikasi</groupId>
<artifactId>aplikasi-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>web</module>
</modules>
</project>Build all modules at once:
mvn clean installmvn clean install builds all modules in dependency order and installs them into the local repository.
Episode 19 covers modern tooling: the declarative Maven versus the flexible Gradle Kotlin DSL, dependency management, the build lifecycle, code formatting with Spotless, linting and automatic quality gates, reproducible builds, and multi-module projects.
Key takeaways:
mvn dependency:tree helps detect dependency conflicts.In the next episode, episode 20, we will discuss microservices and cloud-native Java — microservices architecture and modern Java frameworks, an introduction to Spring Boot, Jakarta EE, Micronaut, Quarkus, and Helidon, Java containerization and GraalVM native images, plus integration of service discovery, circuit breakers, and observability. Time to build for the cloud!