编译spring-cloud-contract-2.2.1.RELEASE源码

鲲鹏镜像站中提供的二进制包是基于开源代码直接编译打包而成的,不含漏洞及BUG修复。
使用开源软件时需遵守开源软件的许可协议。
- 下载spring-cloud-contract-2.2.1.RELEASE源码。
1 2 3
cd /home git config --global http.sslVerify false git clone https://github.com/spring-cloud/spring-cloud-contract.git
- 切换到指定版本。
1 2
cd spring-cloud-contract git checkout v2.2.1.RELEASE
- 替换wiremock-jre8-standalone-2.25.1.jar包。
- 创建库目录“~/.m2/repository/com/github/tomakehurst/wiremock-jre8-standalone/2.25.1/”。
1
mkdir -p ~/.m2/repository/com/github/tomakehurst/wiremock-jre8-standalone/2.25.1/
- 获取wiremock-jre8-standalone-2.25.1.jar包。
1
wget https://mirrors.huaweicloud.com/kunpeng/maven/com/github/tomakehurst/wiremock-jre8-standalone/2.25.1/wiremock-jre8-standalone-2.25.1.jar --no-check-certificate
- 将下载的JAR包复制到库目录下。
1
cp wiremock-jre8-standalone-2.25.1.jar ~/.m2/repository/com/github/tomakehurst/wiremock-jre8-standalone/2.25.1/
- 创建库目录“~/.m2/repository/com/github/tomakehurst/wiremock-jre8-standalone/2.25.1/”。
- 替换hoverfly-junit-0.2.2.jar包。
- 创建库目录“~/.m2/repository/io/specto/hoverfly-junit/0.2.2/”。
1
mkdir -p ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/
- 获取hoverfly-junit-0.2.2.jar包。
1
wget https://mirrors.huaweicloud.com/kunpeng/maven/io/specto/hoverfly-junit/0.2.2/hoverfly-junit-0.2.2.jar --no-check-certificate
- 将下载的JAR包复制到库目录下。
1
cp hoverfly-junit-0.2.2.jar ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/
- 查看该JAR文件。
jar tvf ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/hoverfly-junit-0.2.2.jar
- 将该JAR包解压到指定目录。
unzip ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/hoverfly-junit-0.2.2.jar -d ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/hoverfly-junit-0.2.2
- 切换到解压后的目录,同时将hoverfly_v0.9.1_linux_arm64重命名为hoverfly_v0.9.1_linux_amd64。
cd ~/.m2/repository/io/specto/hoverfly-junit/0.2.2/hoverfly-junit-0.2.2 && mv hoverfly_v0.9.1_linux_arm64 hoverfly_v0.9.1_linux_amd64
- 将当前目录中的所有文件打包为新的JAR包。
jar cvf ../hoverfly-junit-0.2.2.jar -c ./*
- 创建库目录“~/.m2/repository/io/specto/hoverfly-junit/0.2.2/”。
- 执行编译。
1 2
cd /home/spring-cloud-contract ./mvnw clean install -Dgpg.skip=true
若显示BUILD SUCCESS,则编译通过。
- 如果编译时遇到spring-cloud-contract-stub-runner报错,可以参考问题现象描述进行修改。
- 如果编译遇到错误信息“Failed during checkstyle execution”,参考编译Spring Boot时提示Failed during checkstyle execution的解决方法解决。
- 如果编译环境需要借助代理访问互联网,可以参考结论、解决方案及效果进行配置,否则Spring-Cloud-Contract-Gradle-Plugin可能报错。
父主题: 编译安装