下载Springboot项目后,想输入"mvn clean package"运行, “Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.4.RELEASE/spring-boot-starter-parent-2.3.4.RELEASE.pom” 后出现 “problem accessing trust store: DerInputStream.getLength(): lengthTag=109, too big.” 错误,网上查了查,修改Springboot版本、添加依赖、去掉加密检查(后面加上 "-Dmaven.test.skip=true -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true" ),反正能搜到的方法都用了,问题依旧。
后来我试着把Springboot相关依赖全去掉,虽然不检查Springboot相关依赖了,但会出现 “Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom” ,问题依旧。
经过分析,发现问题根源是 “problem accessing trust store: DerInputStream.getLength(): lengthTag=109, too big.” ,百度查相关关键词,没有有效解决;在其他搜索引擎搜索,也没多少;在必应英文搜索,结果更是寥寥无几……
坛友们,还有什么办法解决吗?
补充:
这个错误也许是个突破口,但网上资料很少:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
关于maven使用问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
关注让 “紫雾凌寒” 来帮你回答,本回答结合 DeepSeek
如果还有问题,请评论或点击头像私信,如果有帮助到您, 请关注、采纳、点赞
- 关键点分析:
- 执行“mvn clean package”命令时出现从中央仓库下载依赖的提示,这表明在下载项目所需的Maven依赖时遇到了问题。可能的原因包括网络连接问题、中央仓库服务器故障、代理配置问题等。 - 解决方案:
- 检查网络连接:- 确保你的机器能够正常访问互联网。可以尝试在浏览器中访问“https://repo.maven.apache.org/maven2”,看是否能正常打开。
- 更换镜像源:
- 打开项目的
pom.xml文件。 - 在
<repositories>标签内添加阿里云的镜像源配置:
xml <repository> <id>aliyun</id> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> - 也可以在
<pluginRepositories>标签内添加:
xml <pluginRepository> <id>aliyun</id> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> - 检查代理配置:
- 如果公司或网络环境需要代理,可以在Maven的
settings.xml文件中配置代理。 - 找到
settings.xml文件,通常在%MAVEN_HOME%\conf目录下(Windows)或$MAVEN_HOME/conf目录下(Linux/Mac)。 - 在
<proxies>标签内添加代理配置:
xml <proxy> <id>yourProxyId</id> <active>true</active> <protocol>http</protocol> <host>proxy.server.com</host> <port>8080</port> <username>proxyUsername</username> <password>proxyPassword</password> </proxy>
- 各种方案的优缺点:
- 检查网络连接:- 优点:简单直接,是排查问题的第一步。
- 缺点:只能确定网络是否可达,不能解决仓库本身或代理等深层次问题。
- 更换镜像源:
- 优点:能快速解决因中央仓库访问问题导致的依赖下载失败,而且使用国内镜像源速度通常更快。
- 缺点:如果镜像源配置错误或不稳定,可能仍然无法下载成功。
- 检查代理配置:
- 优点:对于需要代理访问网络的环境是必要的配置步骤。
- 缺点:配置不当可能导致更多问题,而且需要知道正确的代理信息。
- 总结:
- 遇到“mvn clean package”下载依赖出错的情况,首先检查网络连接,确保能正常访问外部资源。如果网络没问题,更换镜像源是一个常用且有效的方法,能显著提高依赖下载速度。最后检查代理配置,确保在需要代理的网络环境下能正确访问仓库。通过这些步骤,基本能解决Maven依赖下载失败的问题,顺利运行项目的打包命令。
希望以上解答对您有所帮助。如果您有任何疑问,欢迎在评论区提出。
解决 无用评论 打赏 举报- 关键点分析: