0

可能重复:
Maven 无法解析本地依赖

我正在使用带有 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

谁能帮帮我,因为我要迟到了

4

1 回答 1

0

一些事情要尝试/确认:

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