一、工具准備
-
JDK 8
-
MAVEN(>=3.5.x)
- IntelliJ IDEA
二、Fork或導入官方源碼
-
方法1: 首先有github帳戶,從官方倉庫https://github.com/spring-cloud/spring-cloud-gateway.git Fork一下。
-
方法2: 為了下載快速,在國內碼雲注冊了帳戶,導入官方倉庫https://github.com/spring-cloud/spring-cloud-gateway.git ,如下圖所示
筆者采用了方法2
為了更快下載依賴包,在maven安裝路經下,配置/conf/settings.xml 阿里鏡像,放在mirrors標簽里
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
使用 IntelliJ IDEA 從自己的倉庫拉取代碼。
在項目路經下執行 mvn package -Dmaven.test.skip=true 命令,結果報錯
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:
3.0.0:check (no-http-checkstyle-validation) on project spring-cloud-gateway: Una
ble to parse configuration of mojo org.apache.maven.plugins:maven-checkstyle-plu
gin:3.0.0:check for parameter sourceDirectories: Cannot assign configuration ent
ry 'sourceDirectories' with value './' of type java.lang.String to property of t
ype java.util.List -> [Help 1]
這個問題找了很久,終於在baidu查到maven版本大於等於3.5,筆者本地maven版本是3.3.3,去官方下載maven最新版本3.6.1,終於執行成功了。
三、參考資料
(轉載本站文章請注明作者和出處諸葛的博客 )