-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Building
This document currently details Maven commands for building Azure SDK For Java.
The build system is configured to support JDK, as well as the current long-term support version of the JDK (currently JDK 11). The commands presented below will work on both JDKs.
A lot of the commands that follow will depend on the availability of the build tooling. This can be installed by running the following:
mvn install -f eng/code-quality-reports/pom.xml To build all the libraries, run the following command
mvn install -f pom.xml -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -DskipSpringITs -DskipTests -Dspotbugs.skip -Djacoco.skipTips: if you're using powershell on windows, you may run into this error[ERROR] Unknown lifecycle phase ".skip". You must specify a valid lifecycle phase or a goal in the format, this can be fixed by telling powershell to stop parsing this command with stop-parsing parameter "--%"
mvn --% install -f pom.xml -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -DskipSpringITs -DskipTests -Dspotbugs.skip -Djacoco.skipTo build the new wave of track 2 libraries only, run the following command
mvn install -f pom.xml -Dgpg.skip -Drevapi.skip -DskipTests -pl com.azure:jacoco-test-coverage -amTo build the libraries for a specific service, run the following command
mvn install -f sdk/<servicename>/pom.xml -Dgpg.skip -Drevapi.skip -DskipTestsFor example, to build appconfiguration client library run the following command
mvn install -f sdk/appconfiguration/pom.xml -Dgpg.skip -Drevapi.skip -DskipTestsTo run unit tests, simply remove -DskipTests option from above commands.
SpotBugs and CheckStyle are configured to break the build if there are any issues discovered by them. It is therefore strongly recommended to run the following maven goals locally before submitting a pull request:
mvn spotbugs:check checkstyle:checkstyle-aggregate -DskipTests -Dgpg.skip -pl "package-id:artifact-id" -amThe build is configured with Revapi to check builds against the latest GA release in Maven. At present, the build is not configured to fail, but very soon it will be configured to fail the build when a breaking change is detected. To check for breaking changes, run the following:
mvn revapi:checkThe default mvn build/install command executes the code quality tools that run analysis for check-style violations, bugs and breaking changes. The build takes more time to complete with these analyses enabled. For intermediate build/install during local development, they can be skipped by adding the following mvn options:
-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true
Note: It is strongly recommended to run the analysis locally before submitting a pull request.
To generate HTML reports for 'Maven Site', as well as aggregate CheckStyle, SpotBugs, Jacoco, Revapi, and JavaDoc reports, you need to run the following commands:
mvn install site:site site:stage -Dgpg.skip mvn test -Dgpg.skip -Dinclude-non-shipping-modulesOnce this completes, the generated reports are available in the following locations:
| Tool | Output Location |
|---|---|
| SpotBugs | /eng/spotbugs-aggregate-report/target/spotbugs/spotbugsXml.html |
| CheckStyle | /target/staging/checkstyle-aggregate.html |
| JavaDoc | /target/staging/apidocs/index.html |
| Revapi | /target/staging/revapi-aggregate-report.html |
| Maven Site | /target/staging/index.html |
| JaCoCo | /eng/jacoco-test-coverage/target/site/test-coverage/index.html |
Samples in all README.md files should use compliable code to ensure they are updated when the source code is updated. To do so, we use a utility tool to embed source code from Java files into README markdown files. Steps to add code snippets in README using the tool:
-
Download and install NodeJS
-
Create
ReadmeSamples.javafile in src/samples/java/ for which README.md should be updated -
Add all the code snippets in the above Java file that should be included in README.md. See How to define a codesnippet reference.
-
Now, in README.md, add the codesnippet reference. See How to inject codesnippet into READMEs.
-
Rebuild the package will embed code automatically,
mvn clean install {path/to/client}/pom.xml - Verify the README.md file to confirm the samples are inserted as expected
- Frequently Asked Questions
- Azure Identity Examples
- Configuration
- Performance Tuning
- Android Support
- Unit Testing
- Test Proxy Migration
- Azure Json Migration
- New Checkstyle and Spotbugs pattern migration
- Protocol Methods
- TypeSpec-Java Quickstart
- Getting Started Guidance
- Adding a Module
- Building
- Writing Performance Tests
- Working with AutoRest
- Deprecation
- BOM guidelines
- Release process
- Access helpers