Maven SSL握手错误:Could not transfer artifact org.springframework.boot
·
执行
mvn clean compile
输出
[INFO] Scanning for projects... Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/3.3.5/spring-boot-starter-parent-3.3.5.pom [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for com.sihan:chatbot-business-backend:0.1.0: The following artifacts could not be resolved: org.springframework.boot:spring-boot-starter-parent:pom:3.3.5 (absent): Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.3.5 from/to central (https://repo.maven.apache.org/maven2): Remote host terminated the handshake and 'parent.relativePath' points at no local POM @ line 7, column 13
先检查你本地有没有 Java 和 Maven
在 mac 终端执行:
java -version
mvn -version
如果 java -version 正常,但 mvn -version 报 command not found,说明 Maven 没装。
如果 mvn -version 能输出版本,但编译时报 SSL,那就是依赖下载网络/证书问题。
进入项目根目录,也就是有 pom.xml 的目录:
cd 你的项目路径
先测试 Maven Central 能不能被你的 Mac 访问
执行:
curl -Iv https://repo.maven.apache.org/maven2/
如果这里也出现 SSL、handshake、connection reset、closed 等问题,说明不是 Maven 的问题,而是你的网络环境访问 Maven Central 有问题。
如果输出
SSL certificate verify ok.
HTTP/2 200
就配置阿里云镜像:
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<'EOF'
<settings>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>Aliyun Maven Central Mirror</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
</settings>
EOF
清理失败缓存:
find ~/.m2/repository -name "*.lastUpdated" -delete
重新编译:
mvn -U clean compile
更多推荐




所有评论(0)