Maven配置settings-security.xml

配置失败

项目中需要连接公司内部远程maven仓库,设置了密码,故而需要配置settings-security.xml文件。

<settingsSecurity>
  <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
</settingsSecurity>

我的本地maven仓库设置在了D盘,非默认.m2文件夹。直接将settings-security.xml文件放入D盘,idea提示权限验证异常,maven加载不到jar包。阅读了官方文档Maven Password Encryption,默认是加载.m2文件夹下的settings-security.xml,所以只在D盘添加settings-security.xml是不可以的,需要在.m2文件夹下也添加一个settings-security.xml。maven重新加载jar包,可以正确加载。

<settingsSecurity>
  <relocation>D:\maven\conf\settings-security.xml</relocation>
</settingsSecurity>
C:\Users\z84405515\.jdks\ms-17.0.15\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Users\z84405515\AppData\Local\Temp\archetype1tmp "-Dmaven.home=C:\Program Files\Maven" "-Dclassworlds.conf=C:\Program Files\Maven\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2024.3.2.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2024.3.2.2\lib\idea_rt.jar=63111:C:\Program Files\JetBrains\IntelliJ IDEA 2024.3.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Maven\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2024.3.2.2 -s "C:\Program Files\Maven\conf\settings.xml" -Dmaven.repo.local=C:\04_DevTools\maven_repo2 -DinteractiveMode=false -DgroupId=com.example -DartifactId=SpringBoot2 -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate [INFO] Scanning for projects... Downloading: https://cmc.centralrepo.rnd.huawei.com/maven/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml Downloading: https://dgg.maven.repo.cmc.tools.huawei.com/artifactory/BPIT-public-maven/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to artifact-plugins (https://dgg.maven.repo.cmc.tools.huawei.com/artifactory/BPIT-public-maven/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to dg-artifact (https://cmc.centralrepo.rnd.huawei.com/maven/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.377 s [INFO] Finished at: 2025-06-10T20:52:53+08:00 [INFO] Final Memory: 9M/48M [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (C:\04_DevTools\maven_repo2) -> [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
06-11
[INFO] Scanning for projects... Downloading from dg-artifact: https://cmc.centralrepo.rnd.huawei.com/maven/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml Downloading from artifact-plugins: https://dgg.maven.repo.cmc.tools.huawei.com/artifactory/BPIT-public-maven/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to artifact-plugins (https://dgg.maven.repo.cmc.tools.huawei.com/artifactory/BPIT-public-maven/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to dg-artifact (https://cmc.centralrepo.rnd.huawei.com/maven/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.365 s [INFO] Finished at: 2025-06-10T20:31:09+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: [ERROR] Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (C:\04_DevTools\maven_repo2) [ERROR] -> [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
06-11
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值