Skip to content
AgileLogics
4 min read

Build Tools: Maven and Gradle

Prerequisites: Multithreading basics

Real Java projects use a build tool to manage dependencies and automate compiling, testing, and packaging — Maven (XML-based, pom.xml) and Gradle (Groovy/Kotlin DSL, build.gradle) are the two dominant choices.

<!-- pom.xml, Maven -->
<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.11.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
mvn compile   # compile the project
mvn test      # run tests
mvn package   # produce a runnable .jar

Both tools follow a standard project layout (src/main/java, src/test/java), so switching between them on different projects feels familiar once you know one.