首页 > 其他分享 >maven mvn install 报错: unable to find valid certification path to requested target 错误

maven mvn install 报错: unable to find valid certification path to requested target 错误

时间:2024-07-07 16:31:00浏览次数:11  
标签:requested 证书 surefire maven apache valid 报错 2.22 org

[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ platform ---
[INFO] Downloading from alimaven: http://maven.aliyun.com/repository/public/org/apache/maven/surefire/maven-surefire-common/2.22.2/maven-surefire-common-2.22.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.424 s
[INFO] Finished at: 2024-07-07T15:48:00+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project platform: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.22.2 -> org.apache.maven.surefire:maven-surefire-common:jar:2.22.2: Failed to read artifact descriptor for org.apache.maven.surefire:maven-surefire-common:jar:2.22.2: Could not transfer artifact org.apache.maven.surefire:maven-surefire-common:pom:2.22.2 from/to alimaven (http://maven.aliyun.com/repository/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

 

解决办法:

1、导入证书:浏览器访问

http://maven.aliyun.com/repository/public 导出证书。

并将其导入到本地的 Java 密钥库中。这样可以让 Maven 信任证书并建立安全连接。你可以使用随 Java 开发工具包 (JDK) 提供的 keytool 命令行工具导入证书。以下是示例命令:

keytool -import -alias my-cert -keystore <密钥库路径> -file <证书路径> 

keytool -import -alias my-cert -keystore C:\Java8\jdk1.8.0_131\jre\lib\security\cacerts -file C:\Users\TOP\Desktop\xxx\xxx.aliyun.com

2、在 Maven 设置中显式信任证书:在你的 settings.xml 文件中添加以下配置,以显式信任远程仓库的证书:

<settings>
  ...
  <profiles>
    <profile>
      <id>trust-repository-certificate</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>my-repository</id>
          <url>https://example.com/repository</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <pluginSnapshots>
            <enabled>true</enabled>
          </pluginSnapshots>
          <trustCertificates>true</trustCertificates>
          <certificatePath>/证书路径</certificatePath>
        </repository>
      </repositories>
    </profile>
  </profiles>
  ...
</settings>

  将 my-repositoryhttps://example.com/repository 和 /证书路径 替换为你的仓库和证书的相应值。

3、禁用证书验证(不推荐):作为最后的手段,你可以在 Maven 设置中禁用证书验证。然而,这不推荐使用,因为它会降低安全性并暴露给潜在的安全风险。要禁用证书验证,在 settings.xml 文件中添加以下配置:

<settings>
  ...
  <ssl>
    <trustAll>true</trustAll>
  </ssl>
  ...
</settings>

  过将 <trustAll> 设置为 true,Maven 将信任所有证书,包括自签名或无效证书。再次强调,这在生产环境中不推荐使用。

 

标签:requested,证书,surefire,maven,apache,valid,报错,2.22,org
From: https://www.cnblogs.com/digdeep/p/18288648

相关文章

  • 服务器自检报错维修
    是一个相对复杂的故障,可能由多种原因引起。一、故障原因分析硬件故障:内存条问题:内存条未插好、损坏或不兼容可能导致自检报错。硬盘故障:硬盘损坏、数据线连接问题或硬盘控制器故障。CPU故障:CPU损坏或安装不当。主板问题:主板上的元件损坏或连接问题。电源问题:电源故障或电......
  • 服务器自检报错,需要更换内存条,怎么更换
    一、准备工作确认服务器型号和规格:通过查看服务器的文档、规格说明书或联系服务器制造商,确认服务器的型号、支持的内存类型和最大容量。确保新购买的内存条与服务器兼容,包括类型(如DDR3、DDR4等)、容量和频率。准备工具:螺丝刀(根据服务器机箱设计可能需要不同尺寸的螺丝刀)。抗......
  • 解决 SQL Server 安装失败均,报错“等待数据库引擎恢复句柄失败”
    解决方案:方案1:格式化硬盘重新分配扇区大小,让扇区大小与SQLServer匹配。此方法可以将整个硬盘格式化掉,当然这样做的结果就是丢失所有文件,并且还需要重装系统。也可以格式化一个硬盘分区,将SQLServer安装到对应的分区就行。方案2:强制模拟扇区大小为4Kb此方法不会影响硬盘分区,......
  • Vscode连接虚拟机报错
    Vscode连接虚拟机报错问题解决问题解释Permissiondenied,pleasetryagain.出现这个问题通常表示身份验证失败。可能的原因有SSH用户密码错误SSH端口非默认SSH配置文件问题虚拟机SSH服务问题:可能SSH服务没有正常启动或防火墙阻止了SSH连接ip地址错误问题分析重新检......
  • MySQL 主从报错“Got fatal error 1236 from master when reading data from binary l
    1、背景一主一从报错,测试环境从库执行showslavestatus\Gmysql>showslavestatus\G***************************1.row***************************Slave_IO_State:Master_Host:10.0.0.51Master_User:repl......
  • python3.7报错ModuleNotFoundError: No module named 'importlib.metadata'
    1.问题今天在使用一个项目的时候遇到以下的问题:ModuleNotFoundError:Nomodulenamed'importlib.metadata'个人的情况:python3.7conda环境中安装了importlib-meta的工具包,版本为6.7.0在引入的过程中,还是出现了问题。这是由于,包的引入方式和包名不一致引起的。具体如下......
  • 解决Pycharm配置R语言环境报错RWrapper terminated, exitcode: 127
    问题解决Pycharm配置R语言环境报错RWrapperterminated,exitcode:127errorwhileloadingsharedlibraries:libR.so:site:stackoverflow.com解决方案1.打开GetEnvVars.R文件打开C:\Users\UserName\AppData\Roaming\JetBrains\PyCharm版本号\plugins\r-plugin\R\目录......
  • nuxt3启动报错The requested module 'file://C:/Users/acer/node_modules/ufo/dist/in
    背景进行某些配置后,启动nuxt3的测试服务器报错。解决下面这个目录并不是npm的全局目录C:/Users/acer/node_modules我的解决办法是直接使用npm或者cnpm全局安装ufo这个包,然后把这个包移到该位置。#npm全局安装路径C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules......
  • centos7服务器yum安装MySQL数据库,以及报错的解决方案
    文章目录1、数据库能做什么?2、数据库由来3、数据库-系统结构4、版本二、部署1、官网地址3.点击[DOCUMENTATION](https://dev.mysql.com/doc/)4.mysql的yum仓库[UsingtheMySQLYumRepository](https://dev.mysql.com/doc/refman/8.4/en/linux-installation-yum-repo......
  • appium自动化测试报错:Unable to launch com.facebook.WebDriverAgentRunner.maukkaki.
    嗨,我是兰若,今天在编写自动化测试用例的时候,appiuminspector报错:Unabletolaunchcom.facebook.WebDriverAgentRunner.maukkaki.xctrunner1、当时首先想到的就是检查WebDriverAgent的构建和安装是否正常,后来发现这块的安装是完全按照官方文档进行的,并且彼时我的手机上已经......