当前位置: 首页 > 面试题库 >

Maven无法解决本地依赖性

端木明贤
2023-03-14
问题内容

我有一个带有内部jar文件的项目内仓库的Maven项目。我使用install命令将jar文件安装到内部注入存储库中,当我在存储库中签入安装jar文件时,我还在pom文件中添加了依赖项配置。但是当我运行mvn编译文件时。我收到mvn无法解决依赖关系的错误

这是Pom片段:

        <repository>
    <id>repo</id>
    <releases>
        <enabled>true</enabled>
        <checksumPolicy>ignore</checksumPolicy>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <url>file://${project.basedir}/repo</url>
</repository>

这是POM中的依赖

<dependency>
      <groupId>Com.RubineEngine.GesturePoints</groupId>
      <artifactId>Com-RubineEngine-GesturePoints</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>

这是错误消息:

[INFO]最终内存:6M / 309M

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project com-boundingbox-box: Could not resolve
 dependencies for project com.boundingbox.box:com-boundingbox-box:jar:1.0-SNAPSH
OT: Could not find artifact Com.RubineEngine.GesturePoints:Com-RubineEngine-Gest
urePoints:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException

是否有人对此错误有任何建议。

这是使用U和X开关后的错误消息

[DEBUG] =======================================================================
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for file://C:\U
sers\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
Downloading: file://C:\Users\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
/Com/RubineEngine/GesturePoints/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/mave
n-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo
.typesafe.com/typesafe/releases/
Downloading: http://repo.typesafe.com/typesafe/releases/Com/RubineEngine/Gesture
Points/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in typesafe (http://repo.typesafe.
com/typesafe/releases/)
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in lib (file://C:\Users\FAISAL\Des
ktop\disaster\com-initialtheta-theta/repo)
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in http://repo.typesafe.com/typesafe/relea
ses/ was cached in the local repository, resolution will not be reattempted unti
l the update interval of typesafe has elapsed or updates are forced
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in file://C:\Users\FAISAL\Desktop\disaster
\com-initialtheta-theta/repo was cached in the local repository, resolution will
 not be reattempted until the update interval of lib has elapsed or updates are
forced

看起来系统在两个存储库之间变得混乱。


问题答案:
  1. 检查是否在项目存储库中的库的pom文件中正确设置了groupId / artifactId(即$ {project.baseDir} \ repo \ Com .... \ 1.0-SNAPSHOT \ Com-RubineEngine-GesturePoints.pom)
  2. 要摆脱“直到lib的更新间隔或强制执行更新,才会重新尝试解决”错误,您需要从本地存储库(通常为〜/ .m2)中删除文件夹,即〜/ .m2 / Com / RubineEngine。


 类似资料:
  • 我在Eclipse4.18中遇到了一个奇怪的问题,我希望有人能帮我解决这个问题。我的项目是一个jetty webapp,它通过FTP与外部服务器进行通信。我正在使用mockftpserver(https://mockftpserver.org/)帮助对需要与FTP服务器通信的代码进行单元测试。 我在pom中将库依赖项定义为 然后我在测试类中定义了一个导入,比如 没有什么太奇怪的事情发生,maven

  • 我们有一个项目a依赖于项目B,项目B依赖于图书馆C。a和B是本地项目,而C是maven central repo的公共图书馆。 波姆。xml用于: 波姆。用于B的xml: 在A中运行mvn dependency:tree-Dverbose时,它不会解析B的依赖项,B中使用的此类依赖项也不会显示在A的Maven依赖项中。这对于编译很好,但在运行时会因为NoClassDefFound错误而失败。 有没

  • 我最近将Android Studio更新为3.0版,随后将Gradle更新为4.1版。 现在,在尝试加载现有项目后,出现以下错误: 错误:无法解决':app@UnitTest /compileClasspath'的依赖关系:无法解决项目:intro-Slider-lib。 错误:无法解决':app@UnitTest /compileClasspath'的依赖关系:无法解决项目:intro-Slid

  • 我正在尝试编译一个名为web server的Maven项目,该项目依赖于指定依赖版本范围[2.0,3.0]内的搜索客户端。但是,由于“没有可用的版本”,编译失败 以下是我将遵循的步骤: 进行更改并在本地构建搜索客户端 这将在我的本地m2存储库中为这个客户端pom构建一个2.0-SNAPSHOT jar。 如果出现以下错误,则无法编译: [错误]未能在项目通用上执行目标:无法解决项目com.test

  • 我已经在pom中配置了本地maven存储库。xml。当我构建项目时,它会显示依赖项下载错误(请参阅下面的日志)。Maven正在尝试从我的本地Maven存储库下载所有依赖项。 日志 这是我的pom。xml文件 本地存储库是http://XXX。XXX。XX。XXX:8081/artifactory/libs本地发布 xml。背景

  • 我正在尝试解决我的eclipse项目中的maven依赖项。 依赖项已经下载到我的maven dependencies文件夹中(如下所示) 然而,import语句仍然没有解析。 在我的java构建路径中,存在Maven Dependencies文件夹。 到目前为止,我已经尝试在命令行上重建项目并在eclipse中刷新它;我尝试在eclipse中重建它;我尝试在eclipse中更新项目。 似乎什么都没