Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
abbaa24
HDDS-11630. Added Building Ozone With Maven guide
ptlrs Oct 31, 2024
8423cf1
HDDS-11630. Updated spelling list
ptlrs Oct 31, 2024
9d4d3f8
HDDS-11630. Fix markdown linter errors
ptlrs Oct 31, 2024
2145ef7
HDDS-11630. Fix review comments
ptlrs Nov 13, 2024
f8459bc
HDDS-11630. Fix review comments
ptlrs Nov 13, 2024
a5d0551
HDDS-11630. Update maven options
ptlrs Nov 13, 2024
ca27d88
HDDS-11630. Fix review comments
ptlrs Nov 14, 2024
7591004
HDDS-11630. Fix review comments
ptlrs Nov 14, 2024
a3499f8
Update docs/08-developer-guide/01-build/01-maven.md
jojochuang Dec 12, 2024
abec6df
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
956f1f3
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
dbb9d0b
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
69cd6be
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
4167650
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
ec98f47
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
a863aa3
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 6, 2025
fb636d0
Merge remote-tracking branch 'upstream/HDDS-9225-website-v2' into HDD…
ptlrs Jan 6, 2025
6ec8baa
HDDS-11630. Fix review comments
ptlrs Jan 6, 2025
38ce41e
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 10, 2025
5de3cf2
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 10, 2025
1eb64c4
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 10, 2025
8face23
HDDS-11630. Fix review comments
ptlrs Jan 10, 2025
30fd649
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 13, 2025
5bfcf48
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 13, 2025
77cfc83
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 13, 2025
ad9fa21
Remove TODO
ptlrs Jan 13, 2025
cef3440
Remove extra lines
ptlrs Jan 13, 2025
e028b18
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 14, 2025
a009dca
Update docs/08-developer-guide/01-build/01-maven.md
ptlrs Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ words:
- UX
- devs
- CLI
- xzf
- Dskip
- Pdist
- Pnative
96 changes: 96 additions & 0 deletions docs/08-developer-guide/01-build/02-maven.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

**TODO** : [HDDS-11625](https://issues.apache.org/jira/browse/HDDS-11625) Finalize the version numbers of prerequisite packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if we can finalize this as part of this change as well. The only thing I'm not sure about is the maven version. Really Ozone should define this in its pom probably using something like the Maven enforcer plugin. Maybe we should raise a PR to add this to the main Ozone repo and then update the docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point we should take advantage of the enforcer plugin to have reproducible builds.

However, what should be considered the minimum version for Maven and Git? We depend on Hadoop and I can see if they have a minimum version specified for Maven.

On that note, it is also not clear what the minimum version of Java should be. We do build with versions 8, 11, 17. Some of the pom files specify the compiler source and target versions to Java 8. Some of the tests fail when run from the IDE with a newer JDK and need extra JVM parameters to allow Java lang and util modules and the security manager.


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

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">
```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

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)
- `-T 4`: Use 4 threads for parallel building (adjust number based on your CPU)
- `-am -pl module-name`: Build a specific module and its dependencies

### Build Output

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

### 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)