-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Instructions for how to build and tests the client libraries or a specific client library is found here. https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md#developer-guide
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" -am
The 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:check
The 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-modules
Once 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 compilable code to ensure they are updated when 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.java
file 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
- Now, in README.md, add the
embedme
tag as shown below (the sample shows inserting code from line number 10 to 20)
<!-- embedme path/to/ReadmeSamples.java#L10-L20 -->
```java
```
- To embed code using the tool, run the following command
npx embedme path/to/README.md
- 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