-
Notifications
You must be signed in to change notification settings - Fork 61
HDDS-11630. Add Build from Maven guide #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
abbaa24
8423cf1
9d4d3f8
2145ef7
f8459bc
a5d0551
ca27d88
7591004
a3499f8
abec6df
956f1f3
dbb9d0b
69cd6be
4167650
ec98f47
a863aa3
fb636d0
6ec8baa
38ce41e
5de3cf2
1eb64c4
8face23
30fd649
5bfcf48
77cfc83
ad9fa21
cef3440
e028b18
a009dca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,3 +99,7 @@ words: | |
| - UX | ||
| - devs | ||
| - CLI | ||
| - xzf | ||
| - Dskip | ||
| - Pdist | ||
| - Pnative | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,99 @@ sidebar_label: Maven | |
|
|
||
| - Cover basic Maven commands to build and run tests. | ||
| - Document all the Ozone specific Maven flags we use to speed up or skip parts of the build, and when they are useful. | ||
|
|
||
| import Tabs from '@theme/Tabs'; | ||
| import TabItem from '@theme/TabItem'; | ||
|
|
||
| This guide explains how to build Apache Ozone from source using Maven and prepare it for deployment. | ||
|
|
||
| ## Prerequisites | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **TODO** : [HDDS-11625](https://issues.apache.org/jira/browse/HDDS-11625) Finalize the version numbers of prerequisite packages | ||
|
||
|
|
||
| Before you begin, ensure you have the following installed on your build machine: | ||
|
|
||
| - Java 1.8 or higher | ||
| - Apache Maven 3.6.3 or higher | ||
| - Git (if building from source repository) | ||
|
|
||
| ## Building Ozone | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| You can build Apache Ozone either by cloning the source code from Git or by downloading the official source tarball. | ||
|
|
||
| ### 1. Obtain the Source Code | ||
|
|
||
| Choose one of the following methods to get the source code: | ||
|
|
||
| <Tabs> | ||
| <TabItem value="Git" label="Git" default> | ||
| ```bash | ||
| git clone https://github.com/apache/ozone.git | ||
| cd ozone | ||
| ``` | ||
| </TabItem> | ||
| <TabItem value="Tarball" label="Tarball"> | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```bash | ||
| curl -OL https://dlcdn.apache.org/ozone/1.4.0/ozone-1.4.0-src.tar.gz | ||
| tar xzf ozone-1.4.0-src.tar.gz | ||
| cd ozone-1.4.0-src | ||
| ``` | ||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| ### 2. Build the Project | ||
|
|
||
| #### Basic Build | ||
|
|
||
| For a basic build that skips tests: | ||
|
|
||
| ```bash | ||
| mvn clean package -DskipTests=true | ||
| ``` | ||
|
|
||
| This command will: | ||
|
|
||
| - Clean previous build artifacts | ||
| - Compile the source code | ||
| - Package the compiled code into JAR files | ||
| - Create a distribution in `hadoop-ozone/dist/target/ozone-<version>` | ||
|
|
||
| #### Build with Tests | ||
|
|
||
| To run unit tests during the build: | ||
|
|
||
| ```bash | ||
| mvn clean package | ||
| ``` | ||
|
|
||
| #### Create Distribution Tarball | ||
|
|
||
| To create a distribution tarball for deployment: | ||
|
|
||
| ```bash | ||
| mvn clean package -DskipTests=true -Pdist | ||
| ``` | ||
|
|
||
| This creates a tarball in `hadoop-ozone/dist/target` that contains all necessary files for deployment. | ||
|
|
||
| ### Maven Build Options | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Several Maven options are available to customize the build process: | ||
|
|
||
| - `-DskipTests=true`: Skip all tests | ||
| - `-Pdist`: Enable the distribution profile to create deployment tarballs | ||
| - `-Pnative`: Build native libraries (requires additional system dependencies) | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `-T 4`: Use 4 threads for parallel building (adjust number based on your CPU) | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `-am -pl module-name`: Build a specific module and its dependencies | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Build Output | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The build process creates several important artifacts: | ||
|
|
||
| - **Distribution Directory**: `hadoop-ozone/dist/target/ozone-<version>/` | ||
| - **Distribution Tarball**: `hadoop-ozone/dist/target/ozone-<version>.tar.gz` (when using `-Pdist`) | ||
| - **Individual Module JARs**: Found in `target/` directories within each module | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Next Steps | ||
|
|
||
| Run the build by deploying the binary on either a [machine](../../05-administrator-guide/01-installation/03-installing-binaries.md) or on a [Docker cluster](../../08-developer-guide/02-run/02-docker-compose.md) | ||
Uh oh!
There was an error while loading. Please reload this page.