java - Maven 无法解决本地依赖

标签 java maven-3

我有一个 Maven 项目,它有一个带有外部 jar 文件的项目内存储库。 我使用安装命令将 jar 文件安装到 in-porject 存储库中 当我检查存储库时,安装了 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.

关于java - Maven 无法解决本地依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12760715/

相关文章:

java - Integer 不是一个引用吗?为什么 inc 不更新 hashmap 值?

java - 如何使用流重写嵌套列表的查找功能

java - 我怎样才能使这段代码更简单?另外我如何检查输入是否是 int?

maven - 排除从父 POM 继承的 Artifact ?

java - 如何读取netty channel 池中的服务器响应?

java - 获取 Android 25 英里半径范围内的邮政编码

java - 如何在maven中将jar从WEB-INF/lib复制到war中的另一个文件夹

maven - liquibase maven 插件多个 changeLogFile

Maven 搜索 site.xml 缺少的英语语言环境

java - 如何mvn部署-部署:file from java app