Failure to find com.ctg.itrdc.cache:ctg-cache:pom

前言

本地打包,需要用到ctg-cache-nclient一个redis连接包,这个远端没有下载不下来,于是复制到对应仓库目录下,选择用IDEA重构maven仓库索引的方式使用此jar包,但是在本地有的情况下,依然选择在远端下载

Failure to find com.ctg.itrdc.cache:ctg-cache:pom:2.7.8 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced

此类问题也是

[ERROR] Failed to execute goal on project efssc: Could not resolve dependencies for project com.eshore:efssc:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.ctg.itrdc.mq:ctg-mq-api:jar:2.7.0, com.ctg.mq:ctg-mq-remoting:jar:2.7.0, com.ctg.mq:ctg-mq-client:jar:2.7.0, com.ctg.mq:ctg-mq-common:jar:2.7.0: Failure to find com.ctg.itrdc.mq:ctg-mq-api:jar:2.7.0 in http://maven.aliyun.com/nexus/content/repositories/central/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [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/DependencyResolutionException

image

问题

多次尝试后发现,是我反向安装的方式不对;此种方式虽然引入并更新了maven仓库,但实际上maven并不识别此jar包,正确方式应该反向安装,通过命令
参考文章:idea 反向安装jar包到仓库
首先从同事那里获得jar包,注意不要直接放到对应仓库目录,随便选个文件夹,地址栏打开cmd,直接执行此命令,默认会读取setting文件,安装到对应目录

mvn install:install-file -DgroupId=com.ctg.itrdc.cache -DartifactId=ctg-cache-nclient -Dversion=2.7.8 -Dpackaging=jar -Dfile=ctg-cache-nclient-2.7.8.jar
 		<dependency>
			<groupId>com.ctg.itrdc.cache</groupId>
			<artifactId>ctg-cache-nclient</artifactId>
			<version>2.7.8</version>
		</dependency>

image

常见问题

  1. mvn无此命令
    对应的maven环境变量有问题,选择重新配置,如果配置了还不生效,可参考此文章,重建两个变量方式
    Maven 环境变量配置 'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件

  2. 直接手动安装到对应目录
    直接删除对应目录的jar ,空白状态安装
    image

  3. 安装错误位置,本地可能有多个maven,环境变量一个,idea用的另一个,使用相同目录

posted @ 2025-08-28 08:54  HezhezhiyuLe  阅读(12)  评论(0)    收藏  举报