Update build documentation (#17444)

Add build instructions for developers
Follow up from issue #17375, add instructions solely for distribution profile. Note that this build command is mostly used by me, everyone is welcome to add further optimizations for a faster distribution build.

Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com>

* Update docs/development/build.md

Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com>

* Update docs/development/build.md

Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com>

---------

Co-authored-by: Abhishek Radhakrishnan <abhishek.rb19@gmail.com>
This commit is contained in:
Virushade 2024-11-05 10:31:46 +08:00 committed by GitHub
parent e4cdbca23c
commit ba76264244
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 8 deletions

View File

@ -29,26 +29,26 @@ For building the latest code in master, follow the latest version of this page
[here](https://github.com/apache/druid/blob/master/docs/development/build.md):
make sure it has `/master/` in the URL.
#### Prerequisites
## Prerequisites
##### Installing Java and Maven
### Installing Java and Maven
- See our [Java documentation](../operations/java.md) for information about obtaining a supported JDK
- [Maven version 3.x](http://maven.apache.org/download.cgi)
##### Other dependencies
### Other Dependencies
- Distribution builds require Python 3.x and the `pyyaml` module.
- Integration tests require `pyyaml` version 5.1 or later.
##### Downloading the source
## Downloading the Source Code
```bash
git clone git@github.com:apache/druid.git
cd druid
```
#### Building from source
## Building from Source
The basic command to build Druid from source is:
@ -56,7 +56,7 @@ The basic command to build Druid from source is:
mvn clean install
```
This will run static analysis, unit tests, compile classes, and package the projects into JARs. It will _not_ generate the source or binary distribution tarball.
This will run static analysis, unit tests, compile classes, and package the projects into JARs. It will _not_ generate the source or binary distribution tarball. Note that this build may take some time to complete.
In addition to the basic stages, you may also want to add the following profiles and properties:
@ -72,9 +72,25 @@ Putting these together, if you wish to build the source and binary distributions
mvn clean install -Papache-release,dist,rat -DskipTests
```
#### Potential issues
### Building for Development
##### Missing `pyyaml`
For development, use only the dist profile and skip the Apache release and Apache rat profiles.
```bash
mvn clean install -Pdist -DskipTests
```
If you want to speed up the build even more, you can enable parallel building with the `-T1C` option and skip some static analysis checks.
```bash
mvn clean install -Pdist -T1C -DskipTests -Dforbiddenapis.skip=true -Dcheckstyle.skip=true -Dpmd.skip=true -Dmaven.javadoc.skip=true -Denforcer.skip=true
```
You will expect to find your distribution tar file under the `distribution/target` directory.
## Potential issues
### Missing `pyyaml`
You are building Druid from source following the instructions on this page but you get
```