build.md 2.8 KB
Newer Older
1
---
2 3
id: build
title: "Build from source"
4 5
---

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

25

26
You can build Apache Druid directly from source. Please note that these instructions are for building the latest stable version of Druid.
C
Clint Wylie 已提交
27
For building the latest code in master, follow the instructions [here](https://github.com/apache/druid/blob/master/docs/development/build.md).
28

29 30 31 32

#### Prerequisites

##### Installing Java and Maven:
33 34
- JDK 8, 8u92+. We recommend using an OpenJDK distribution that provides long-term support and open-source licensing,
  like [Amazon Corretto](https://aws.amazon.com/corretto/) or [Azul Zulu](https://www.azul.com/downloads/zulu/).
35 36
- [Maven version 3.x](http://maven.apache.org/download.cgi)

37 38
##### Other Dependencies
- for distribution build, Python and yaml module are required
39 40


41
##### Downloading the source:
42

43
```bash
44
git clone git@github.com:apache/druid.git
45 46 47
cd druid
```

B
Bingkun Guo 已提交
48

49 50
#### Building the source

51
The basic command to build Druid from source is:
52 53

```bash
54
mvn clean install
55 56
```

57 58 59
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.

In addition to the basic stages, you may also want to add the following profiles and properties:
60

61 62 63 64
- **-Pdist** - Distribution profile: Generates the binary distribution tarball by pulling in core extensions and dependencies and packaging the files as `distribution/target/apache-druid-x.x.x-bin.tar.gz`
- **-Papache-release** - Apache release profile: Generates GPG signature and checksums, and builds the source distribution tarball as `distribution/target/apache-druid-x.x.x-src.tar.gz`
- **-Prat** - Apache Rat profile: Runs the Apache Rat license audit tool
- **-DskipTests** - Skips unit tests (which reduces build time)
65
- **-Ddruid.console.skip=true** - Skip front end project
66

67
Putting these together, if you wish to build the source and binary distributions with signatures and checksums, audit licenses, and skip the unit tests, you would run:
68 69

```bash
70 71
mvn clean install -Papache-release,dist,rat -DskipTests
```