【问题标题】:maven missing artifactmaven缺少工件
【发布时间】:2014-01-04 02:51:31
【问题描述】:

我有一个 Maven 项目,直到昨天还在正常构建。现在,每当我尝试使用 m2e 构建时,它都无法构建,因为它无法解析依赖项,但这些依赖项并没有丢失,它们可以在我的本地存储库中找到。我知道以前有人问过这个问题,但没有一个答案能解决我的问题。我尝试了很多东西:

  • 正在删除缓存。
  • 关闭项目并重新打开它。
  • 对项目进行全新安装。

还没有结果。那么有没有更系统的程序来解决这个问题呢?

编辑日志:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building itunit-workflow 1.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.activiti:activiti-bpmn-converter:jar:5.13 is missing, no dependency information available
[WARNING] The POM for org.springframework:spring-beans:jar:3.1.2.RELEASE is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.279s
[INFO] Finished at: Mon Dec 16 18:30:10 GMT+02:00 2013
[INFO] Final Memory: 5M/76M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project itunit-workflow: Could not resolve dependencies for project org.itunit.itunit:itunit-workflow:ejb:1.0.2-SNAPSHOT: The following artifacts could not be resolved: org.activiti:activiti-bpmn-converter:jar:5.13, org.springframework:spring-beans:jar:3.1.2.RELEASE: Cannot access central (http://repo.maven.apache.org/maven2) in offline mode and the artifact org.activiti:activiti-bpmn-converter:jar:5.13 has not been downloaded from it before. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

【问题讨论】:

  • 尝试运行自定义目标mvn clean install -oo 指定离线
  • 你可以从这两个地方做,对于 eclipse run as > maven build... 注意 3 点然后输入这个目标
  • 同样的问题无法解决依赖
  • 请检查您是否在 Eclipse 首选项中使用相同的 maven 安装。
  • 不,我没有启用离线模式,但我在没有互联网的机器上工作(不要离线使用)。但我在本地 Maven 存储库中有所有依赖项

标签: java maven m2eclipse


【解决方案1】:

这通常发生在从一种 Maven 配置更改为另一种时。就我而言,我正在从直接连接切换到 maven Central 到使用 nexus 作为镜像。

在本地 \Users\YourUser\.m2 文件夹中删除 maven-metadata*.xml_*.repositories 对我来说很有效。

希望这会有所帮助!

【讨论】:

  • 删除 maven-metadata*.xml 和 _*.repositories 对我有用。谢谢。另一个想法是,当我们将一个 maven 配置切换到另一个时,清理 .m2 文件夹并不是一个坏主意。
  • 删除 _*.repositories 已经对我有用,不需要删除 maven-metadata*.xml
  • BTW @bob-cac,恕我直言,这应该是公认的答案。
  • 就是这样。我为不同的 maven 存储库设置了配置文件,所以当我在离线模式下运行 -o 时,我仍然必须使用正确的存储库配置文件运行。
【解决方案2】:

在 IntelliJ 中: - 转到文件 -设置 -在搜索框左上角输入“maven”。 -单击maven选项 - 查看是否选中了脱机工作框。如果是,则取消选中它

在 Eclipse 中: - 单击绿色运行图标上的小下拉箭头。 -单击运行配置并选择您的Maven构建配置 - 查看是否选中了“离线”框。如果是,则取消选中它

如果你这样做并且仍然遇到同样的问题,那么我会选择@Faliorn 解决方案

【讨论】:

  • 确实,禁用了“脱机工作”选项,它起作用了。为什么我首先启用了这个选项,这是一个问题......谢谢
  • 该解决方案对我有用。 “脱机工作”选项被选中然后当我取消选中它时工作,将所有 maven 重新导入项目并重新启动 IntelliJ
【解决方案3】:

我在尝试使用 Intellij IDEA Maven 插件进行安装时遇到了这个问题。但是当我使用本地 Maven 安装进行安装时,问题就消失了。 如果你有同样的问题尝试安装新的 Maven 并运行mvn install

【讨论】:

    猜你喜欢
    • 2013-07-12
    • 2015-05-08
    • 1970-01-01
    • 2016-09-13
    • 2013-02-08
    • 1970-01-01
    • 1970-01-01
    • 2013-03-12
    • 2011-02-25
    相关资源
    最近更新 更多