构建Dubbo-2.0.7源码

时间:2020-12-23 05:47:47

一. 下载源码:

git clone --branch dubbo-2.0.7 https://github.com/apache/incubator-dubbo.git

二. 下载依赖

git clone https://github.com/alibaba/opensesame.git

修改pom.xml为如下内容, 主要是更改repo地址为aliyun

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.alibaba</groupId>
<artifactId>opensesame</artifactId>
<version>1.0</version>
<packaging>pom</packaging> <name>OpenSeame Super POM</name>
<description>Super POM For OpenSesame Projects</description>
<inceptionYear>2011</inceptionYear> <properties>
<!-- for distribution management -->
<opensesame_snapshots_distribution_repository>dav:https://maven.aliyun.com/repository/snapshots</opensesame_snapshots_distribution_repository>
<opensesame_releases_distribution_repository>dav:https://maven.aliyun.com/repository/releases</opensesame_releases_distribution_repository>
<opensesame_sites_distribution_repository>dav:https://maven.aliyun.com/repository/sites</opensesame_sites_distribution_repository> <!-- for maven compiler plugin -->
<maven_compiler_plugin_version>2.3.2</maven_compiler_plugin_version>
<java_source_version>1.5</java_source_version>
<java_target_version>1.5</java_target_version>
<file_encoding>UTF-8</file_encoding> <maven_source_plugin_version>2.1.1</maven_source_plugin_version>
<maven_jar_plugin_version>2.3.2</maven_jar_plugin_version>
<maven_war_plugin_version>2.1.1</maven_war_plugin_version>
<maven_install_plugin_version>2.3.1</maven_install_plugin_version>
<maven_deploy_plugin_version>2.7</maven_deploy_plugin_version>
</properties> <licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses> <distributionManagement> <snapshotRepository>
<id>opensesame.snapshots.account</id>
<url>${opensesame_snapshots_distribution_repository}</url>
</snapshotRepository> <repository>
<id>opensesame.releases.account</id>
<url>${opensesame_releases_distribution_repository}</url>
</repository> <site>
<id>opensesame.sites.account</id>
<url>${opensesame_sites_distribution_repository}</url>
</site> </distributionManagement> <repositories> <repository>
<id>opensesame.snapshots</id>
<url>https://maven.aliyun.com/repository/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository> <repository>
<id>opensesame.releases</id>
<url>https://maven.aliyun.com/repository/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> <repository>
<id>opensesame.jcenter</id>
<url>https://maven.aliyun.com/repository/jcenter</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> <repository>
<id>opensesame.public</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> <repository>
<id>central.repo</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> </repositories> <pluginRepositories>
<pluginRepository>
<id>central.repo.plugin</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>opensesame.snapshots.plugin</id>
<url>https://maven.aliyun.com/repository/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>opensesame.releases.plugin</id>
<url>https://maven.aliyun.com/repository/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories> <build> <plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven_source_plugin_version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>true</attach>
</configuration>
</plugin> </plugins> <pluginManagement> <plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven_jar_plugin_version}</version>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven_war_plugin_version}</version>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven_install_plugin_version}</version>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven_deploy_plugin_version}</version>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven_compiler_plugin_version}</version>
<configuration>
<source>${java_source_version}</source>
<target>${java_target_version}</target>
<encoding>${file_encoding}</encoding>
</configuration>
</plugin> </plugins> </pluginManagement> </build> </project>

然后执行mvn install

三. 修改pom.xml

到根目录的pom.xml中

hessian_version为3.2.3版本

fastjson_version为1.1.44版本

<hessian_version>3.2.4</hessian_version>
<fastjson_version>1.1.44</fastjson_version>

删除pom.xml中的repositories

	<repositories>
<repository>
<id>opensesame.releases</id>
<url>http://code.alibabatech.com/mvn/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

更改工程中hessian.lite 为 hessian-lite

四. 安装依赖

到dubbo-common目录中执行mvn install

五. 用IDEA打开工程