提交 06b6f054 编写于 作者: _木木-'s avatar _木木- 提交者: wu-sheng

Add how to build in eclipse (#1464)

* Update How-to-build-CN.md
上级 630e6231
......@@ -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节点下添加如下配置:
```
<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>
```
其次需要支持多source目录,但eclipse的m2e插件还没支持到execution,需要在在build节点下添加如下配置:
```
<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>
```
3. 修改apm-collector-remote/collector-remote-grpc-provider/pom.xml文件,添加google guava的依赖
```
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>24.0-jre</version>
</dependency>
```
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不会自动编译。如需编译对应的插件,
......
......@@ -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:
```
<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>
```
3. 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>
```
4. 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>
```
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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册