Nx provides powerful tooling for Java projects, supporting both Gradle and Maven build systems. Whether you're working with Spring Boot, Micronaut, Quarkus, or any other Java framework, Nx helps you build faster and more efficiently.
Requirements
Section titled “Requirements”Quick Start
Section titled “Quick Start”Install Nx
Section titled “Install Nx”You can install Nx globally. Depending on your package manager, use one of the following commands:
npm add --global nx@latest
brew install nx
choco install nx
sudo add-apt-repository ppa:nrwl/nxsudo apt updatesudo apt install nx
Add Nx to Your Java Project
Section titled “Add Nx to Your Java Project”In any Gradle or Maven project, run the following command to add Nx:
nx init
Nx will automatically detect your build tool and you can then add the appropriate plugin (see Build System Support below).
Build System Support
Section titled “Build System Support”Nx offers dedicated plugins for the two most popular Java build tools:
- @nx/gradle - For projects using Gradle
- @nx/maven - For projects using Maven (experimental, requires Nx 22+)
Add the plugin for your build system:
nx add @nx/gradle# ornx add @nx/maven
These Nx plugins for Gradle and Maven register your Gradle or Maven projects in your Nx workspace, and allow their tasks to be run through Nx. Nx effortlessly makes your CI faster.
For a hands-on tutorial, check out the Gradle tutorial.
What Nx Adds to Your Java Workspace
Section titled “What Nx Adds to Your Java Workspace”Nx enhances your Java development workflow with:
- Smart Caching - Cache build and test results to avoid redundant work
- Distributed Task Execution - Run tasks in parallel across multiple machines in CI
- Affected Commands - Only build and test what changed
- Interactive Graph - Visualize your project dependencies
- CI Optimization - Make your CI pipeline dramatically faster