maven学习

本文档介绍了在使用阿里云Maven镜像仓库时遇到的报错问题,包括证书验证失败、插件下载失败和清理项目时的文件占用问题。提供了解决方案,如设置IDEA VM参数、检查证书配置以及处理被占用的文件目录。同时,还提及了如何在Maven项目中创建和管理多个模块。
摘要由CSDN通过智能技术生成

输出:

阿里云maven镜像仓库:
maven下载链接:https://maven.apache.org/
maven中央仓库:https://mvnrepository.com/

遇到的问题:

1、 在新建项目目录下mvn compile时,提示如下报错

 Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://cmc.centralrepo.rnd.huawei.com/artifactory/product_maven/): transfer failed for https://cmc.centralrepo.rnd.huawei.com/artifactory/product_maven/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

黄色部分是maven settings.xml中设置的mirror url
红色部分报错参考链接:
http://3ms.huawei.com/km/blogs/details/11283157
使用的证书文件参考链接:
http://3ms.huawei.com/km/blogs/details/12395835
IDEA导入maven项目后,提示证书问题可以参考链接:
1、 在maven setting中增加VM 参数:
在maven importing下面的VM options for importer中添加: -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

2、如果IDEA仍然显示插件导入失败,可以重新点击clean install

2、 mvn compile出现如下结果

Downloading from central: https://cmc.centralrepo.rnd.huawei.com/artifactory/product_maven/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[WARNING] The POM for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 is missing, no dependency information available
Downloading from central: https://cmc.centralrepo.rnd.huawei.com/artifactory/product_maven/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.657 s
[INFO] Finished at: 2022-07-13T14:51:57+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in central (https://cmc.centralrepo.rnd.huawei.com/artifactory/product_maven/) -> [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

3、mvn clean时报错

ugins:maven-clean-plugin:2.5:clean (default-clean) on project maven-project: Failed to clean project: Failed to delete D:\EgineeringCode\maven-project\target\surefire-reports

定位原因:这个目录被进程占用,无法删除
解决方案参考:
idea Failed to clean project Failed to delete target_小北海的北海的博客-CSDN博客


 

4. 怎么使用maven创建多个module,将多个module展示在一个页面中

在java-project项目下创建子项目servlet-01

注意:如果servlet-01需要tomcat插件,则需要在子项目pom文件中定义,插件无法从父pom中继承到子pom

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值