首页 > 其他分享 >mvn 构建错误总结

mvn 构建错误总结

时间:2023-04-26 17:47:59浏览次数:45  
标签:总结 ei 302002 jar hw 构建 ERROR org mvn

问题总结:
mvn仓库查找顺序
本地仓库=>没有就找中央仓库=>远程仓库

mvn 构建失败三大原因

1.误删除 ./m2文件夹,构建失败

  • 解决:重新使用中央仓库拉取配置

2.本地仓库是否有错误依赖(以lastUpdated结尾)缓存失败;

产生的原因:可能是网络波动或者前期新手配置有误
解决方案: 删除本地有问题的依赖
命令:find * -type f -name "*.lastUpdated"|xargs rm -f

3.本地缓存删除完,再重新打包,还是报错、

思路:查看配置settings配置

[root@localhost g7lite-dos]# cat /data/home/soft/maven/conf/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
  <mirror>
    <id>huawei-maven</id>
    <url>https://repo.huaweicloud.com/repository/maven/</url>
    <mirrorOf>central</mirrorOf>                      
  </mirror>
</mirrors>

central 这段central和*还是有区别的,要写成central

比如说华为的使用的是*,后面还需要跟!HuaweiCloudSDK

<mirror>
   <id>huaweicloud</id>
   <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>
   <url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>

4.最后有些依赖需要的是私服包,如果有报错可能存在原因是401密码失败

私服包记得配置用户名和密码

    <servers>
        <server>
            <id>rdc-releases</id>
            <username>6406ded884946b4453bf</username>
            <password>gIqj1xuO8-</password>
        </server>
        <server>
            <id>rdc-snapshots</id>
            <username>6406de2454d96b4453bf</username>
            <password>gIqj1xuOy-</password>
        </server> 
        </servers>

5.第五点,如果有特殊的依赖包,比如说华为的

参考:https://mirrors.huaweicloud.com/home

<profile>
    <id>MyProfile</id>
    <repositories>
        <repository>
            <id>HuaweiCloudSDK</id>
            <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>HuaweiCloudSDK</id>
            <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
   </profile>

需要在最下方配置
增加activeProfiles标签激活配置:

<activeProfiles>
<activeProfile>MyProfile</activeProfile>
</activeProfiles>

=============================================================================

以下是细节排错

记一次mvn构建打包失败
我将 ./m2的文件全给删除了,此时配置的mvn命令无法打包,各种报错。

报错如下
mvn clean install -Dmaven.test.skip=true
[INFO] Scanning for projects...
[ERROR][ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.systemPath' for com.chinawayltd.java.spec:globally-unique-id-generator:jar should not point at files within the project directory, ${basedir}/lib/globally-unique-id-generator-1.0.0-SNAPSHOT.jar will be unresolvable by dependent projects @ line 183, column 25
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 315, column 21
[WARNING] The expression ${name} is deprecated. Please use ${project.name} instead. @ 
[WARNING] The expression ${name} is deprecated. Please use ${project.name} instead. @ 
[ERROR] Non-resolvable import POM: Could not find artifact com.chinawayltd.g7lite:g7lite-dependencies:pom:1.0.0-SNAPSHOT @ line 368, column 25
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 38, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 52, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-configuration-processor:jar is missing. @ line 57, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-expression:jar is missing. @ line 62, column 21
[ERROR] 'dependencies.dependency.version' for org.apache.commons:commons-lang3:jar is missing. @ line 66, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar is missing. @ line 70, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-openfeign:jar is missing. @ line 80, column 21
[ERROR] 'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar is missing. @ line 84, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-actuator:jar is missing. @ line 88, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-data-redis:jar is missing. @ line 102, column 21
[ERROR] 'dependencies.dependency.version' for org.projectlombok:lombok:jar is missing. @ line 106, column 21
[ERROR] 'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ line 134, column 21
[ERROR] 'dependencies.dependency.version' for com.alibaba:fastjson:jar is missing. @ line 165, column 21
[ERROR] 'dependencies.dependency.version' for com.ctrip.framework.apollo:apollo-client:jar is missing. @ line 171, column 21
 @ 
[ERROR] The build could not read 1 project -> [Help 1][ERROR]   
[ERROR]   The project com.chinawayltd.g7lite:ins-saas-uc:1.0.0 (/root/thb/g7-saas-uc/pom.xml) has 15 errors
[ERROR]     Non-resolvable import POM: Could not find artifact com.chinawayltd.g7lite:g7lite-dependencies:pom:1.0.0-SNAPSHOT @ line 368, column 25 -> [Help 2][ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 38, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 52, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-configuration-processor:jar is missing. @ line 57, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-expression:jar is missing. @ line 62, column 21
[ERROR]     'dependencies.dependency.version' for org.apache.commons:commons-lang3:jar is missing. @ line 66, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar is missing. @ line 70, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-openfeign:jar is missing. @ line 80, column 21
[ERROR]     'dependencies.dependency.version' for com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar is missing. @ line 84, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-actuator:jar is missing. @ line 88, column 21
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-data-redis:jar is missing. @ line 102, column 21
[ERROR]     'dependencies.dependency.version' for org.projectlombok:lombok:jar is missing. @ line 106, column 21
[ERROR]     'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ line 134, column 21
[ERROR]     'dependencies.dependency.version' for com.alibaba:fastjson:jar is missing. @ line 165, column 21
[ERROR]     'dependencies.dependency.version' for com.ctrip.framework.apollo:apollo-client:jar is missing. @ line 171, column 21
[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/ProjectBuildingException
[ERROR][Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

#参考解决方案:
https://blog.csdn.net/cushier/article/details/82223656
总结:意思就是把 .m2整个仓库删掉,配置mvn的中央仓库再拉取一遍



仓库依赖不存在
此时我可以进行构建了,但是我构建的项目是华为的大数据,此时又出现了本地仓库依赖不存在的问题,于是我又新增了华为的mvn仓库源

我在settings配置了很多多个源
报错如下
实际上,把mvn官方的中央仓库给删掉,此时就可以重新加载了。

问题3
但是,我发现用了华为源后,有些可以download,但是我需要的那些依赖包又没找到,报错。
报错如下 
mvn clean install -Dmaven.test.skip=true -X 详细排查了下

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.6.0-hw-ei-302002, org.elasticsearch:elasticsearch:jar:7.6.0-hw-ei-302002, org.elasticsearch.client:elasticsearch-rest-client:jar:7.6.0-hw-ei-302002, org.apache.hadoop:hadoop-common:jar:3.1.1-hw-ei-302002, org.apache.hbase:hbase-common:jar:2.2.3-hw-ei-302002, org.apache.hbase:hbase-client:jar:2.2.3-hw-ei-302002: Failure to find org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.6.0-hw-ei-302002 in https://mirrors.huaweicloud.com/repository/maven/ was cached in the local repository, resolution will not be reattempted until the update interval of huawei-maven has elapsed or updates are forced
说好像被缓存了,于是我去本地仓库去找,发现了本地缓存的文件

[root@localhost 7.6.0-hw-ei-302002]# ll
total 8
-rw-r--r-- 1 root root 374 Apr 26 10:47 elasticsearch-rest-client-7.6.0-hw-ei-302002.jar.lastUpdated
-rw-r--r-- 1 root root 374 Apr 26 10:46 elasticsearch-rest-client-7.6.0-hw-ei-302002.pom.lastUpdated

这种结尾的
参考博客: https://blog.csdn.net/MXDMAX/article/details/123513034
原因可能是因为网络波动,或者找不到包但是下载了上述的文件   删掉,重新跑一遍就可以了。
find * -type f  -name "*.lastUpdated" |xargs rm -f 



[root@localhost repository]# find * -type f  -name "*.lastUpdated"
com/chinawayltd/g7lite/g7lite-common/1.0.0-SNAPSHOT/g7lite-common-1.0.0-20221118.064604-1.pom.lastUpdated
org/apache/hadoop/hadoop-common/3.1.1-hw-ei-302002/hadoop-common-3.1.1-hw-ei-302002.pom.lastUpdated
org/apache/hadoop/hadoop-common/3.1.1-hw-ei-302002/hadoop-common-3.1.1-hw-ei-302002.jar.lastUpdated
org/apache/hbase/hbase-common/2.2.3-hw-ei-302002/hbase-common-2.2.3-hw-ei-302002.pom.lastUpdated
org/apache/hbase/hbase-common/2.2.3-hw-ei-302002/hbase-common-2.2.3-hw-ei-302002.jar.lastUpdated
org/apache/hbase/hbase-client/2.2.3-hw-ei-302002/hbase-client-2.2.3-hw-ei-302002.pom.lastUpdated
org/apache/hbase/hbase-client/2.2.3-hw-ei-302002/hbase-client-2.2.3-hw-ei-302002.jar.lastUpdated
org/elasticsearch/client/elasticsearch-rest-client/7.6.0-hw-ei-302002/elasticsearch-rest-client-7.6.0-hw-ei-302002.pom.lastUpdated
org/elasticsearch/client/elasticsearch-rest-client/7.6.0-hw-ei-302002/elasticsearch-rest-client-7.6.0-hw-ei-302002.jar.lastUpdated
org/elasticsearch/client/elasticsearch-rest-high-level-client/7.6.0-hw-ei-302002/elasticsearch-rest-high-level-client-7.6.0-hw-ei-302002.pom.lastUpdated
org/elasticsearch/client/elasticsearch-rest-high-level-client/7.6.0-hw-ei-302002/elasticsearch-rest-high-level-client-7.6.0-hw-ei-302002.jar.lastUpdated
org/elasticsearch/elasticsearch/7.6.0-hw-ei-302002/elasticsearch-7.6.0-hw-ei-302002.pom.lastUpdated
org/elasticsearch/elasticsearch/7.6.0-hw-ei-302002/elasticsearch-7.6.0-hw-ei-302002.jar.lastUpdated
[root@localhost repository]# find * -type f  -name "*.lastUpdated" |xargs rm -f 
[root@localhost repository]# find * -type f  -name "*.lastUpdated"
[root@localhost repository]# cd 

标签:总结,ei,302002,jar,hw,构建,ERROR,org,mvn
From: https://www.cnblogs.com/zongliang-ya/p/17356822.html

相关文章

  • 【收藏】网络安全信息收集知识大总结!!!
    资产收集概述渗t的本质是信息收集,信息收集又名资产收集。在确定了范围、目标、方法之后就到进行情报收集阶段。这个阶段收集的信息,确定了往后渗t测试的走向。收集的信息越多越好,项目的成功与否,与信息收集息息相关,由此可见信息收集是有多重要。whois查询域名注册信息信息包括注册人......
  • 用java调用oracle存储过程总结
    用java调用oracle存储过程总结[code]1、什么是存储过程。存储过程是数据库服务器端的一段程序,它有两种类型。一种类似于SELECT查询,用于检索数据,检索到的数据能够以数据集的形式返回给客户。另一种类似于INSERT或DELETE查询,它不返回数据,只是执行一个动作。......
  • Java泛型简单总结
    [code]Java泛型简单总结1)基本概念:泛型(GenericType或Generics)是对Java语言的类型系统的一种扩展,以支持创建可以按类型进行参数化的类。可以把类型参数看做是使用参数化类型时指定的类型的一个占位符,就像方法的形式参数是运行时传递的占位符一......
  • Struts2总结
    Struts2总结[code]一、Struts2概述Struts2其实并不是一个陌生的Web框架,Struts2是以Webwork的设计思想为核心,吸收了Struts1的优点,因此,可以认为Struts2是Struts1和Webwork结合的产物。一、MVC简介Struts2是一个兼容Struts1和WebWork的MVC框架,既然......
  • Jsp基础知识总结
    [code]首先来说一下我们jsp的课程:第一部分为Servlet技术,包括Servelt入门,会话跟踪,JavaMal和Servlet.第二部分就是Jsp技术,包括:jsp简介,jsp脚本和指令的使用,jsp隐式对象,JavaBean与jsp中的标准动作,jsp表达式语言,自定义标签,jsp自定义表签库.第三部......
  • vi总结
    yy拷贝当前行nyy拷贝当前后开始的n行,比如2yy拷贝当前行及其下一行。p 在当前光标后粘贴,如果之前使用了yy命令来复制一行,那么就在当前行的下一行粘贴。shift+p在当前行前粘贴ndd剪切当前行之后的n行。利用p命令可以对剪切的内容进行粘贴......
  • shell编程总结
    一,执行shell程序文件有三种方法(1)#shfile(2)#.file(3)#sourcefileshell常用的系统变量$#:保存程序命令行参数的数目$?:保存前一个命令的返回码$0:保存程序名$*:以("$1$2...")的形式保存所有输入的命令行参数$@:......
  • 决策树算法总结
    决策树(DecisionTree)决策树是一种树形结构,以信息熵为度量构造一棵熵值下降最快的树,它每个内部节点表示在某个特征上的分割使得分割前后熵值下降最快,到叶子结点处的熵值为零,此时每个叶结点中的样本都被归为同一类(训练时叶结点中数据的真实类别未必为同一类)。决策树算法递归的选择......
  • 4月25号总结
    今天老师专门找了几个组讨论问题,非常幸运,我们就在其中,老师对我们的选题作了详细的分析划分了我们需要做什么,完成什么功能,主要分为以下几点:1、首先要把图片中表格的信息存储到数据库中,只有存到数据库里了,才有后面对数据的一系列操作2、添加历史记录,标题,关键字,供用户更方便的使用......
  • 第一阶段绩效总结
    根据对团队的奉献值王集洲:独自完成物流公司后台系统(100分)陈俊杰:完成达梦数据库连接、客户端Web界面设计(70%)、后端Java代码编写(80%)(50分)冯嘉乐:客户端Web界面设计(30%)、后端Java代码编写(20%)(25分)......