From 06b6f0543854db4f5a238daa5ceea808f120fab1 Mon Sep 17 00:00:00 2001 From: mumu <84226733@qq.com> Date: Wed, 18 Jul 2018 11:10:56 +0800 Subject: [PATCH] Add how to build in eclipse (#1464) * Update How-to-build-CN.md --- docs/cn/How-to-build-CN.md | 75 ++++++++++++++++++++++++++++++++++++++ docs/en/How-to-build.md | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) diff --git a/docs/cn/How-to-build-CN.md b/docs/cn/How-to-build-CN.md index 461ca2d0f7ac..f90e77505a66 100644 --- a/docs/cn/How-to-build-CN.md +++ b/docs/cn/How-to-build-CN.md @@ -28,6 +28,81 @@ 1. 设置gRPC的自动生成代码目录,为源码目录 - **apm-protocol/apm-network/target/generated-sources/protobuf**目录下的`grpc-java`和`java`目录 - **apm-collector/apm-collector-remote/apm-remote-grpc-provider/target/generated-sources/protobuf**目录下的`grpc-java`和`java`目录 + +## 在IntelliJ IDEA中编译工程 +上述步骤在命令行中,能够很好的编译工程,但导入到编译器中的工程依然会有一些报错,我们需要进行几步简单的操作。 +1. 在IntelliJ Terminal中,执行`mvn compile -Dmaven.test.skip=true`进行编译 +1. 设置gRPC的自动生成代码目录,为源码目录 + - **apm-protocol/apm-network/target/generated-sources/protobuf**目录下的`grpc-java`和`java`目录 + - **apm-collector/apm-collector-remote/apm-remote-grpc-provider/target/generated-sources/protobuf**目录下的`grpc-java`和`java`目录 + +## 在Eclipse IDE中编译工程 +1. 导入incubator-skywalking maven工程 +2. 在主目录incubator-skywalking/pom.xml文件中添加如下两个plugin配置,首先配置多源码目录支持,在build/plugins节点下添加如下配置: +``` + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + src/java/main + apm-protocol/apm-network/target/generated-sources/protobuf + apm-collector/apm-collector-remote/collector-remote-grpc-provider/target/generated-sources/protobuf + + + + + +``` +其次需要支持多source目录,但eclipse的m2e插件还没支持到execution,需要在在build节点下添加如下配置: +``` + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + build-helper-maven-plugin + [1.8,) + + add-source + + + + + + + + + + ``` +3. 修改apm-collector-remote/collector-remote-grpc-provider/pom.xml文件,添加google guava的依赖 + ``` + + com.google.guava + guava + 24.0-jre + +``` +4. 执行`mvn compile -Dmaven.test.skip=true`进行编译 +5. 执行maven update,切记去掉勾选 Clean projects选项(会清掉complie生成的proto转化Java文件) +6. mvn compile 编译collector-remote-grpc-provider和apm-protocol工程并Refresh ## 编译Resin-3, Resin-4 和 Oracle JDBC 驱动插件 为了遵守Apache关于协议(License)的相关要求,不符合Apache相关要求的类库所对应的Plugin不会自动编译。如需编译对应的插件, diff --git a/docs/en/How-to-build.md b/docs/en/How-to-build.md index dbcef397922e..06f187ac13be 100644 --- a/docs/en/How-to-build.md +++ b/docs/en/How-to-build.md @@ -25,6 +25,75 @@ This document helps people to compile and build the project in your maven and se 1. Set **Generated Source Codes** folders. * `grpc-java` and `java` folders in **apm-protocol/apm-network/target/generated-sources/protobuf** * `grpc-java` and `java` folders in **apm-collector/apm-collector-remote/apm-remote-grpc-provider/target/generated-sources/protobuf** + +## Setup your Eclipse IDE +1. Import the project as a maven project +2. For supporting multiple source directories, you need to add the following configuration in `incubator-skywalking/pom.xml` file: +``` + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + add-source + generate-sources + + add-source + + + + src/java/main + apm-protocol/apm-network/target/generated-sources/protobuf + apm-collector/apm-collector-remote/collector-remote-grpc-provider/target/generated-sources/protobuf + + + + + +``` +3. Add the following configuration under to let eclipse's M2e plug-in supports execution's solution configuration +``` + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + build-helper-maven-plugin + [1.8,) + + add-source + + + + + + + + + +``` +4. Adding Google guava dependency to apm-collector-remote/collector-remote-grpc-provider/pom.xml files +``` + + com.google.guava + guava + 24.0-jre + +``` +5. Run `mvn compile -Dmaven.test.skip=true` +6. 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) +7. Run `mvn compile` complie collector-remote-grpc-provider and apm-protocol +8. Refresh project ## Building Resin-3, Resin-4, and OJDBC sdk plugins Due to license incompatibilities/restrictions these plugins under `apm-sniffer/apm-sdk-plugin/` are not built by default.