Mac构建Spring Boot 源码

本文解决Maven项目中出现的编译错误及jar包下载缓慢问题,通过更改Maven配置文件中的镜像源加速下载并解决编译器缺失问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息:

1.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project spring-boot-test-support: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

2. 下载不下来jar包,一直卡着下不下来的情况更换maven配置文件中的下载地址(电脑默认下载的maven和你自己下载的maven有可能不是同一个)

我下载的maven地址:/Users/youshang/software/apache/apache-maven-3.6.3/conf/settings.xml
电脑默认下载的maven地址:/Users/youshang/.m2/wrapper/dists/apache-maven-3.5.4-bin/4lcg54ki11c6mp435njk296gm5/apache-maven-3.5.4/conf/settings.xml

编辑电脑默认maven地址,将里面的settings.xml修改为阿里的下载地址

    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

构建第一步:

git clone https://github.com/spring-projects/spring-boot.git

第二步:

想要构建快一点可以选择屏蔽一些项目,比如Springboot中的test项目之类的

.....非常抱歉最后我用idea自己构建的时候又没出现过那个情况了而且还没办法复现。。。。

我使用的构建全部命令

#克隆远程分支代码
git clone git@gitee.com:liaojuhui/learing-spring-boot.git

#进入项目
cd learing-spring-boot

#本地 新建/切换 到learning-spring-boot 并且依赖于 tag 版本为 v2.2.4.RELEASE
git checkout -b learning-spring-boot v2.2.4.RELEASE

#构建项目,并且跳过测试
./mvnw clean install -DskipTests -Pfast

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值