【问题标题】:Maven Dependency error [duplicate]Maven依赖错误[重复]
【发布时间】:2012-10-07 04:14:23
【问题描述】:

可能重复:
Maven Cannot Resolve Local Dependency

我正在使用带有 eclispe juno 的 maven 3。

创建maven项目后,我使用了eclipse插件 生成eclipse文件并将项目导入eclipse。

我已将我创建的 jar 添加到 maven 项目中。

jar 文件安装到项目本地存储库中。 那是项目基目录中一个名为 repo 的文件。

install:install-file 命令用于将 jar 添加到 repo 文件中, 然后将 jar 依赖项添加到项目的 Pom 文件中。

在 Eclipse IDE 中,我可以将 jar 文件导入为 任何其他库导入。

但是,当我运行 mvn compile 命令时, 我得到一个依赖错误,maven 说 找不到 jar 文件。我提供以下代码。

这是 POM repo 配置

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

这是依赖配置

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

使用 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 repo 
.typesafe.com/typesafe/releases/ 
Downloading: repo.typesafe.com/typesafe/… 
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 (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 repo.typesafe.com/typesafe/… 
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

谁可以帮帮我,因为我要迟到了

【问题讨论】:

  • 我有一个愚蠢的问题我必须问:你之前在工作空间中成功构建过任何 maven 工件吗?
  • 您在依赖项声明中使用快照版本似乎很奇怪,但是您尝试从中获取它的存储库已禁用快照。我找不到关于如何设置的具体说明,但我敢打赌这是不正确的。一种可能有帮助的资源是maven.apache.org/ref/3.0.4/maven-model/maven.html

标签: java eclipse maven-3


【解决方案1】:

要尝试/确认的一些事情:

  • 机器是否可以访问互联网。不要只是说有。通过 ping 远程来确认。 Maven 不喜欢无法访问存储库
  • 在 pom 编辑器中,是否显示任何错误消息?您可以删除依赖项并使用添加依赖项对话框添加它吗?
  • 尝试将存储库放在 Eclipse 工作区之外。从理论上讲,它应该可以在它所在的位置工作,但是拥有存储库是一个奇怪的地方,而且 maven 不喜欢“奇怪”。
  • 转到存储库根目录并确认文件夹名称与依赖项的组 ID、工件 ID 和版本完全匹配。

【讨论】:

    猜你喜欢
    • 2013-07-12
    • 2014-06-07
    • 2020-06-29
    • 2011-01-19
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多