一、編譯
文檔:https://github.com/apache/skywalking/blob/master/docs/en/guides/How-to-build.md#build-from-github
搬運:
Build from GitHub
- Prepare git, JDK8+ and Maven 3.6+
-
Clone project
If you want to build a release from source codes, provide a
by usingtag name
while cloning.git clone -b [tag_name] ...
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
- Run
./mvnw clean package -DskipTests
- All packages are in
(.tar.gz for Linux and .zip for Windows)./dist
NOTICE: If you clone the codes from GitHub, please make sure that you had finished step 1 to 3 in section Build from GitHub, if you download the source codes from the official website of SkyWalking, please make sure that you had followed the steps in section Build from Apache source code release.
- Import the project as a maven project
- Run
to compile project and generate source codes. Because we use gRPC and protobuf../mvnw compile -Dmaven.test.skip=true
- Set Generated Source Codes folders.
-
andgrpc-java
folders in apm-protocol/apm-network/target/generated-sources/protobufjava
-
andgrpc-java
folders in oap-server/server-core/target/generated-sources/protobufjava
-
andgrpc-java
folders in oap-server/server-receiver-plugin/receiver-proto/target/generated-sources/protobufjava
-
andgrpc-java
folders in oap-server/exporter/target/generated-sources/protobufjava
-
andgrpc-java
folders in oap-server/server-configuration/grpc-configuration-sync/target/generated-sources/protobufjava
-
folder in oap-server/oal-grammar/target/generated-sourcesantlr4
-
注意:由于Skywalking用到的lombok,是以idea必須要裝這個插件
二、調試
與調試chaosblade代碼類似:
好處:
- 打斷點分析問題
- 修改代碼不用編譯,實時生效
效果圖

(調試skywalking采樣算法)
遠端java程式需要配置一下jvm參數
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
IDEA配置