How-to-build.md 3.9 KB
Newer Older
W
Wing 已提交
1 2
# How to build a project
This document will help you compile and build a project in your maven and set your IDE.
wu-sheng's avatar
wu-sheng 已提交
3

W
Wing 已提交
4 5
## Building the Project
**Since we are using Git submodule, we do not recommend using the `GitHub` tag or release page to download source codes for compiling.**
6

W
Wing 已提交
7 8
### Maven behind the Proxy
If you need to execute build behind the proxy, edit the *.mvn/jvm.config* and set the follow properties:
9
```properties
J
José Augusto 已提交
10 11 12 13 14 15 16 17
-Dhttp.proxyHost=proxy_ip
-Dhttp.proxyPort=proxy_port
-Dhttps.proxyHost=proxy_ip
-Dhttps.proxyPort=proxy_port 
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=password
```

W
Wing 已提交
18
### Building from GitHub
19
1. Prepare git, JDK11+, and Maven 3.6+.
W
Wing 已提交
20
1. Clone the project.
21

W
Wing 已提交
22
    If you want to build a release from source codes, set a `tag name` by using `git clone -b [tag_name] ...` while cloning.
23 24 25 26 27 28 29 30 31 32 33 34 35
    
    ```bash
    git clone --recurse-submodules https://github.com/apache/skywalking.git
    cd skywalking/
    
    OR
    
    git clone https://github.com/apache/skywalking.git
    cd skywalking/
    git submodule init
    git submodule update
    ```
   
36
1. Run `./mvnw clean package -Dmaven.test.skip`
37
1. All packages are in `/dist` (.tar.gz for Linux and .zip for Windows).
38

W
Wing 已提交
39 40
### Building from Apache source code release
- What is the `Apache source code release`?
wu-sheng's avatar
wu-sheng 已提交
41

W
Wing 已提交
42
For each official Apache release, there is a complete and independent source code tar, which includes all source codes. You could download it from [SkyWalking Apache download page](http://skywalking.apache.org/downloads/). There is no requirement related to git when compiling this. Just follow these steps.
wu-sheng's avatar
wu-sheng 已提交
43

44
1. Prepare JDK11+ and Maven 3.6+.
45
1. Run `./mvnw clean package -Dmaven.test.skip`.
wu-sheng's avatar
wu-sheng 已提交
46
1. All packages are in `/dist`.(.tar.gz for Linux and .zip for Windows).
wu-sheng's avatar
wu-sheng 已提交
47

W
Wing 已提交
48 49 50
### Advanced compiling
SkyWalking is a complex maven project that has many modules. Therefore, the time to compile may be a bit longer than usual.
If you just want to recompile part of the project, you have the following options:
51 52
- Compile backend and package
>  ./mvnw package -Pbackend,dist
53 54 55 56 57

or

> make build.backend

58 59 60
If you intend to compile a single plugin, such as one in the dev stage, you could
>  cd plugin_module_dir & mvn clean package

61 62 63
- Compile UI and package
>  ./mvnw package -Pui,dist

64 65 66 67 68
or

> make build.ui


W
Wing 已提交
69 70
### Building docker images
You can build docker images of `backend` and `ui` with `Makefile` located in root folder.
71

G
Gao Hongtao 已提交
72
Refer to [Build docker image](../../../docker) for more details.
73

W
Wing 已提交
74
## Setting up your IntelliJ IDEA
75
**NOTE**: If you clone the codes from GitHub, please make sure that you have finished steps 1 to 3 in section **[Build from GitHub](#building-from-github)**. If you download the source codes from the official website of SkyWalking, please make sure that you have followed the steps in section **[Build from Apache source code release](#building-from-apache-source-code-release)**.
D
Daming 已提交
76

W
Wing 已提交
77 78
1. Import the project as a maven project.
1. Run `./mvnw compile -Dmaven.test.skip=true` to compile project and generate source codes. The reason is that we use gRPC and protobuf.
wu-sheng's avatar
wu-sheng 已提交
79
1. Set **Generated Source Codes** folders.
80
    * `grpc-java` and `java` folders in **apm-protocol/apm-network/target/generated-sources/protobuf**
X
XiaoFu 已提交
81
    * `grpc-java` and `java` folders in **oap-server/server-core/target/generated-sources/protobuf**
82
    * `grpc-java` and `java` folders in **oap-server/server-receiver-plugin/receiver-proto/target/generated-sources/fbs**
wu-sheng's avatar
wu-sheng 已提交
83
    * `grpc-java` and `java` folders in **oap-server/server-receiver-plugin/receiver-proto/target/generated-sources/protobuf**
wu-sheng's avatar
wu-sheng 已提交
84
    * `grpc-java` and `java` folders in **oap-server/exporter/target/generated-sources/protobuf**
85
    * `grpc-java` and `java` folders in **oap-server/server-configuration/grpc-configuration-sync/target/generated-sources/protobuf**
86
    * `grpc-java` and `java` folders in **oap-server/server-alarm-plugin/target/generated-sources/protobuf**
W
wuguangkuo 已提交
87
    * `antlr4` folder in **oap-server/oal-grammar/target/generated-sources**