Building the Azure SDK for Java

April 23, 2026 · View on GitHub

See also: Getting Started · Code Quality


Prerequisites

Install the build tooling once before running the commands below:

mvn install -f eng/code-quality-reports/pom.xml

The build system supports JDK 8 through JDK 21. All commands below work on any supported JDK.


Common Build Commands

Build everything (skip tests and analysis)

mvn install -f pom.xml \
  -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip \
  -Drevapi.skip -DskipSpringITs -DskipTests -Dspotbugs.skip -Djacoco.skip

PowerShell note: If the -D flags cause a parse error, use the stop-parsing token:

mvn --% install -f pom.xml -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -DskipSpringITs -DskipTests -Dspotbugs.skip -Djacoco.skip

Build a specific service

mvn install -f sdk/<servicename>/pom.xml -Dgpg.skip -Drevapi.skip -DskipTests
# Example:
mvn install -f sdk/appconfiguration/pom.xml -Dgpg.skip -Drevapi.skip -DskipTests

Build with tests

Remove -DskipTests from any of the above commands.

Build the Track 2 client libraries

mvn install -f pom.xml -Dgpg.skip -Drevapi.skip -DskipTests \
  -pl com.azure:jacoco-test-coverage -am

Skipping Analysis Locally

During iterative development you can skip all code-quality tools to speed up the build:

-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true

Reminder: Always run analysis before opening a pull request.
See Code Quality for the specific commands.


Generating HTML Reports

Spotbugs, CheckStyle, Revapi, and JavaDocs

mvn install site:site site:stage -Dgpg.skip

JaCoCo test coverage

mvn test -Dgpg.skip -Dinclude-non-shipping-modules

Report output locations after generation:

ReportPath
SpotBugseng/spotbugs-aggregate-report/target/spotbugs/spotbugsXml.html
CheckStyletarget/staging/checkstyle-aggregate.html
JavaDoctarget/staging/apidocs/index.html
Revapitarget/staging/revapi-aggregate-report.html
Maven Sitetarget/staging/index.html
JaCoCoeng/jacoco-test-coverage/target/site/test-coverage/index.html

Code Snippets in README Files

README samples use the CodeSnippet Maven Plugin so that samples stay in sync with source code.

Steps to add a new snippet:

  1. Install Node.js.

  2. Create ReadmeSamples.java in src/samples/java/ for the library.

  3. Add snippet blocks using the snippet reference format.

  4. In README.md, add the injection reference:

    ```java readme-sample-yourSampleName
    // snippet injected here automatically
    ```
    
  5. Rebuild the package; the snippet is embedded automatically:

    mvn clean install path/to/client/pom.xml
    
  6. Verify README.md contains the injected sample.


Project Structure: pom.xml vs sdk/<service>/pom.xml

The repo commonly uses two Maven build scopes:

FilePurpose
pom.xml (root)Aggregates all modules for repo-wide builds
sdk/<service>/pom.xmlService-level aggregator POM for building modules under a single service area

Use sdk/<service>/pom.xml when building within a service pipeline context or when you want to build only one service area.