【问题标题】:maven add dependency located on a local repositorymaven 添加位于本地存储库上的依赖项
【发布时间】:2015-08-03 14:09:04
【问题描述】:

我有一个来自 Github 的 maven 项目,我将其 fork,然后将其导入 eclipse。它包含三个 Maven 模块。我添加了第五个

现在我想将这第五个(新)作为依赖项添加到以前的模块之一。

我在 maven 中进行了安装,并将 jar 放在我的本地存储库中。现在,当我将依赖项添加到以前的模块之一时,我收到错误消息,即我的新模型在公共依赖项中不存在。我的意思是:

Failed to execute goal on project moquette-broker: Could not resolve dependencies for project org.eclipse.moquette:moquette-broker:jar:0.7: Failure to find org.eclipse.moquette:moquette-configurationmanager:jar:0.7 in https://repo.eclipse.org/content/repositories/paho-releases/ was cached in the local repository, resolution will not be reattempted until the update interval of Paho Releases has elapsed or updates are forced -> [Help 1]

我的问题是如何告诉 eclipse 在我的本地存储库中进行搜索?

我尝试将我的依赖项上传到公共存储库,但它现在没有任何意义,因为我仍在开发中

你能帮忙吗

我本地存储库中的 jar

这是我为了调用我的新模块而放入 pom 中的内容

<dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>moquette-configurationmanager</artifactId>
            <version>${project.version}</version>
            <scope>Test</scope>
        </dependency>

我发布的图像是我的本地存储库,因为我可以从我的 Eclipse 中看到它,如下所示:

【问题讨论】:

  • 你试过 mvn clean install -U 吗?
  • 您是否检查过安装是否正常,并创建了文件$userprofile/.m2/repository/org/eclipse/moquette/moquette-broker/0.7/moquette-broker-0.7.jar
  • @JFPicard 是的,我遇到了同样的错误,即Failed to execute goal on project moquette-broker: Could not resolve dependencies for project org.eclipse.moquette:moquette-broker:jar:0.7: Could not find artifact org.eclipse.moquette:moquette-configurationmanager:jar:0.7 in Paho Releases (https://repo.eclipse.org/content/repositories/paho-releases/) -&gt; [Help 1]
  • @LittleSanti 是的,我检查过了,它在同一个位置。肉眼可以看到
  • 你能发布你的 pom.xml 吗?

标签: java eclipse maven


【解决方案1】:

在阅读了前 28 个 cmets 和对您的问题的回答后,我仍然无法想象这个奇怪错误的原因,所以您必须再调试一下:

调试 Maven 构建的两个建议:

  • 无论您运行什么测试,执行mvn --debug &lt;phase&gt; 并仔细分析生成的日志。
  • 运行 mvn dependency:build-classpath 询问 Maven 类路径中引用的下载库在哪里。

【讨论】:

    猜你喜欢
    • 2013-04-01
    • 2011-03-11
    • 2014-03-01
    • 2012-02-03
    • 2020-07-13
    • 2016-04-18
    • 2015-11-13
    • 2014-06-18
    • 1970-01-01
    相关资源
    最近更新 更多