【问题标题】:maven 3 Failed to read artifact descriptor formaven 3无法读取工件描述符
【发布时间】:2011-07-03 05:04:51
【问题描述】:

我升级到使用嵌入式 maven 3 的 netbeans 7。我有一个包含许多模块和包含其他模块的模块的项目。我的其他不依赖于内部项目的子模块可以在相同的配置下正常工作。在这种情况下,spring-hibernate 依赖于作为子模块之一的域并且失败。

我的主要项目有这样的东西

<modelVersion>4.0.0</modelVersion>

<artifactId>spring</artifactId>
<packaging>pom</packaging>

<groupId>${masterproject.groupId}</groupId>
<version>${masterproject.version}</version>

我的子模块有以下定义

<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>spring</artifactId>
    <groupId>${masterproject.groupId}</groupId>
    <version>${masterproject.version}</version>
</parent>

<artifactId>spring-hibernate</artifactId>
<packaging>pom</packaging>

<dependency>
        <groupId>${masterproject.groupId}</groupId>
        <artifactId>domain</artifactId>
</dependency>

我正在使用以下 ${masterproject.groupId}, ${masterproject.version} 因为我不想在所有子模块中放置静态值,因为每个子模块都包含一个父模块。不确定这是否是问题的原因。

所有这一切都适用于 maven 2。但使用 maven 3 我收到以下错误消息

Failed to read artifact descriptor for com.merc:domain:jar:1.0-SNAPSHOT: Failure to find ${masterproject.groupId}:MavenMasterProject:pom:${masterproject.version} in http://repository.springsource.com/maven/bundles/release was cached in the local repository, resolution will not be reattempted until the update interval of com.springsource.repository.bundles.release has elapsed or updates are forced -> [Help 1]

【问题讨论】:

  • 不,我更新了 pom.xml 以使用像 snapshot-1.0 这样的静态值。但想改用属性

标签: maven maven-3 pom.xml


【解决方案1】:

我在 Eclipse 中有这个并做了这个修复它(即使我的命令行构建工作)

  1. 删除.m2/repostiory/....中的目录
  2. 在我的 IDE 中重新运行更新依赖项

mvn 命令行工作,而我的 IDE 没有,一旦我在我的 IDE 中运行它,两者都工作..非常奇怪。

作为另一种选择, 重启 eclipse 似乎也有帮助

【讨论】:

  • 我遇到了同样的问题,这个解决方案对我有用。令人沮丧的是我的 IDE(netbeans)和 CL maven 互相踩到了对方的脚趾……我习惯于从终端做大多数 mvn 和 svn 的东西,但是当我清理和构建 w/ 依赖项时,一切又开始工作了。 ..
  • 是的,我更喜欢 ivy 并将 jars 复制到输出/库中,因此不必使用 m2eclipse 插件,在过去 6 年我一直在使用它并关闭它似乎有问题。跨度>
  • 你提到 m2eclipse 很有趣。这实际上是我从 eclipse 切换到 netbeans 的原因。我真的很喜欢 maven(或者更确切地说,我真的很喜欢 maven 的想法。有时它真的让我很沮丧),而且 netbeans 有杀手级的 maven 支持。
【解决方案2】:

一种可能性是您在profiles.xml 中指定masterproject.groupIdmasterproject.version 的值。如果是这样,在maven3中就是no longer supported

【讨论】:

    【解决方案3】:

    该消息,尤其是 Failure to find 部分,意味着您在 pom.xml 文件中缺少相应属性的描述:

    <properties>
        <masterproject.version>the.appropriate.version</masterproject.version>
    </properties>
    

    请注意:此类错误可能会引发许多相关错误!

    【讨论】:

      【解决方案4】:

      我有同样的问题,maven 不喜欢有一个非常量(即属性)的父版本。

      尝试将您的父元素更改为:

      <parent>
          <artifactId>spring</artifactId>
          <groupId>${masterproject.groupId}</groupId>
          <version>1.0-SNAPSHOT</version>
      </parent>
      

      显然,它不必是1.0-SNAPSHOT,它只需要是某个静态版本即可。

      希望这会有所帮助。

      【讨论】:

        猜你喜欢
        • 2011-10-02
        • 1970-01-01
        • 2018-10-20
        • 1970-01-01
        • 1970-01-01
        • 2019-02-27
        • 2019-08-10
        • 1970-01-01
        • 2016-05-08
        相关资源
        最近更新 更多