【发布时间】:2021-11-05 04:08:21
【问题描述】:
我需要在我的 maven 项目中添加第三方 jar。在我的本地,我使用命令mvn install:install-file -DlocalRepositoryPath=/home/sandesha-uat/.m2/repository -DcreateChecksum=true -Dpackaging=jar -Dfile=/home/******/third-party.jar -DgroupId=com.xyz.abc -DartifactId=somefunction -Dversion=1.0 安装了 jar,并将其作为依赖项添加到我的一个微服务 pom.xml 中
<dependency>
<groupId>com.xyz.abc</groupId>
<artifactId>somefunction</artifactId>
<version>1.0</version>
</dependency>
但是在外部服务器上,当我尝试使用命令mvn install:install-file -DlocalRepositoryPath=/home/sandesha-server/.m2/repository -DcreateChecksum=true -Dpackaging=jar -Dfile=/home/******/third-party.jar -DgroupId=com.xyz.abc -DartifactId=somefunction -Dversion=1.0 安装 jar 时,它会抛出以下错误,
Could not resolve dependencies for project com.sandesha:mymicroservice:jar:0.0.1-SNAPSHOT: Failure to find com.xyz.abc:somefunction:jar:1.0 in https://repo.maven.apache.org/maven2 已缓存在本地存储库中,解析将在中心的更新间隔过去或强制更新之前不会重新尝试
我可以看到 jar 安装在 .m2 中。这里出了什么问题?
【问题讨论】:
-
您是否尝试过强制更新?
-
看看这个链接:techexpertise.medium.com/…
-
你在使用 IDE 吗?
-
不。通过 linux 终端在服务器上
标签: java spring-boot maven maven-3 maven-plugin