一、编译
文档: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配置