Guide for New Contributors to Start avoid Pitfalls
Preface
As a first-time developer in the Shenyu community, I encountered some "Pitfalls" that were not mentioned in the tutorials I followed to start and develop the project. I have documented the detailed steps I took to start shenyu, shenyu-dashboard, shenyu-website in this blog, hoping to help more new contributors in the community.
Environmental Preparation
- Correct local installation of
JDK17+ - Properly install
Gitlocally - Correctly install Maven
3.6.3+ - Choose a development tool, this article uses
IDEAas an example
ShenYu Backend Startup Guide
Install and Configure Maven
Maven is a cross-platform project management tool . As the Apache organization's top open source projects , its main service for Java-based platform project creation , dependency management and project information management.
-
Download maven and extract it to a path with no Chinese and no spaces.
-
Add the
bindirectory under themavendirectory to the environment variables. ForWindows, if the download directory isE:\apache-maven-3.9.1, addE:\apache-maven-3.9.1\binto thePathsystem variable. -
Verify that the installation was successful. Type
mvn -vin the cmd window, and if the Maven version and Java version appear, the installation is successful. This is shown below:C:\Users\pc>mvn -v
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: E:\apache-maven-3.9.1
Java version: 18.0.1.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-18.0.1.1
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows" -
To speed up the download of project-related dependencies, you need to change the Maven mirrors, here add Aliyun and other mirrors. Change the
<mirrors> </mirrors>tag pair inconf/settings.xmlto the following:<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>maven</id>
<mirrorOf>central</mirrorOf>
<name>name_</name>
<url>http://repo1.maven.org/maven2</url>
</mirror>
<mirror>
<id>junit</id>
<mirrorOf>central</mirrorOf>
<name>junit address/</name>
<url>http://jcenter.bintray.com/</url>
</mirror>
</mirrors>and add
<localRepository>E:/maven_local_repository</localRepository>to the next line of</mirrors>to set the location of Maven local repository. You can specify the exact location yourself.
Pull ShenYu Code
-
Fork ShenYu repository on Github to your own repository, where you can develop and commit PRs in the future
-
Use Git to download the repository from the previous step locally:
git clone git@github.com:${YOUR_USERNAME}/${TARGET_REPO}.gitIf prompted for a long file name, execute the following command via the command line:
git config --global core.longpaths trueTips: If you encounter the following error or have network issues preventing you from pulling all the code:
RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8) 2057 bytes of body are still expected fetch-pack: unexpected disconnect while reading sideband packet early EOF fetch-pack: invalid index-pack outputYou can execute the following commands to first pull a single version of the code, then fetch the full code:
git clone https://github.com/apache/shenyu.git --depth 1
cd ./shenyu
git fetch --unshallow