This document helps people to compile and build the project in your maven and set your IDE.
Because we are using Git submodule, we recommend don't use GitHub
tag or release page to download source codes for compiling.
- Prepare git, JDK8 and maven3
git clone https://github.com/apache/skywalking.git
cd skywalking/
- Switch to the tag by using
git checkout [tagname]
(Optional, switch if want to build a release from source codes) git submodule init
git submodule update
- Run
./mvnw clean package -DskipTests
- All packages are in
/dist
(.tar.gz for Linux and .zip for Windows).
- What is
Apache source code release
?
For each official Apache release, there is a complete and independent source code tar, which is including all source codes. You could download it from SkyWalking Apache download page. No git related stuff required when compiling this. Just follow these steps.
- Prepare JDK8 and maven3
- Run
./mvnw clean package -DskipTests
- All packages are in
/dist
.(.tar.gz for Linux and .zip for Windows).
SkyWalking is a complex maven project, including many modules, which could cause long compiling time. If you just want to recompile part of the project, you have following options
- Compile agent and package
./mvnw package -Pagent,dist
or
make build.agent
- Compile backend and package
./mvnw package -Pbackend,dist
or
make build.backend
- Compile UI and package
./mvnw package -Pui,dist
or
make build.ui
We can build docker images of backend
and ui
with Makefile
located in root folder.
- Build all docker images
make docker.all
- Build oap server docker image
make docker.oap
- Build ui docker image
make docker.ui
HUB
and TAG
variables ares used to setup REPOSITORY
and TAG
of a docker image. To get
a oap image with name bar/oap:foo
, run the following command
HUB=bar TAG=foo make docker.oap
NOTICE: If you clone the codes from GitHub, please make sure that you had finished step 1 to 7 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
./mvnw compile -Dmaven.test.skip=true
to compile project and generate source codes. Because we use gRPC and protobuf. - Set Generated Source Codes folders.
grpc-java
andjava
folders in apm-protocol/apm-network/target/generated-sources/protobufgrpc-java
andjava
folders in oap-server/server-core/target/generated-sources/protobufgrpc-java
andjava
folders in oap-server/server-receiver-plugin/receiver-proto/target/generated-sources/protobufgrpc-java
andjava
folders in oap-server/exporter/target/generated-sources/protobufgrpc-java
andjava
folders in oap-server/server-configuration/grpc-configuration-sync/target/generated-sources/protobufantlr4
folder in oap-server/generate-tool-grammar/target/generated-sources
NOTICE: If you clone the codes from GitHub, please make sure that you had finished step 1 to 7 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
- For supporting multiple source directories, you need to add the following configuration in
skywalking/pom.xml
file:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/java/main</source>
<source>apm-protocol/apm-network/target/generated-sources/protobuf</source>
<source>apm-collector/apm-collector-remote/collector-remote-grpc-provider/target/generated-sources/protobuf</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
- Add the following configuration under to let eclipse's M2e plug-in supports execution's solution configuration
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<versionRange>[1.8,)</versionRange>
<goals>
<goal>add-source</goal>
</goals>
</pluginExecutionFilter>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
- Adding Google guava dependency to apm-collector-remote/collector-remote-grpc-provider/pom.xml files
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>24.0-jre</version>
</dependency>
- Run
./mvnw compile -Dmaven.test.skip=true
- Run
maven update
. Must remove the clean projects item before maven update(This will be clear the proto conversion Java file generated by the complie) - Run
./mvnw compile
compile collector-remote-grpc-provider and apm-protocol - Refresh project