【问题标题】:Changing pom.xml doesn't update libraries in Eclipse更改 pom.xml 不会更新 Eclipse 中的库
【发布时间】:2013-04-30 05:40:35
【问题描述】:

我有这样的 pom.xml:

...

<properties>
    <spring.version>3.0.5.RELEASE</spring.version>
</properties>

<dependencies>

    <!-- Spring 3 dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

...

当我将 spring.version 更改为 3.2.2.RELEASE 时,没有任何反应。我在库构建路径下还有 3.0.5.RELEASE。

我正在使用带有 m2eclipse 的 Eclipse Indigo SR2。

编辑:请注意,我是 Maven 世界的新手。

【问题讨论】:

  • 您需要手动更新项目配置。 项目 -> Maven -> 更新配置.
  • 我没有这个选项。
  • 可能无法下载3.2.2.RELEASE。打开一个全新的项目,只输入(像这样)&lt;dependency&gt;&lt;groupId&gt;org.springframework&lt;/groupId&gt;&lt;artifactId&gt;spring-core&lt;/artifactId&gt;&lt;version&gt;3.2.2.RELEASE&lt;/version&gt;&lt;/dependency&gt;,看看它是否获得了没有错误的版本。
  • @Trick 检查你是否有一个条目 Project -> Maven ?如果是,则应该有 ProjectConfiguration 之类的内容。此外更好地更新到 Juno Eclipse 并安装 m2e。
  • @acdcjunior,在其他项目中它确实下载没有错误

标签: eclipse maven pom.xml m2eclipse


【解决方案1】:

您需要手动更新项目配置。项目 -> Maven -> 更新配置

更新: 同时设置复选框:Update Project Configuration from pom

【讨论】:

  • 我没有这个选项。不在项目上右键单击或在菜单栏中项目...
  • 如果缺少Maven选项,需要先将项目转为maven项目。 右键,配置 -> 转换为 Maven 项目
【解决方案2】:

右键单击包资源管理器中的任何项目,然后选择 Maven。在 Maven 中选择更新项目。或者干脆 Alt + F5

【讨论】:

  • 除上述之外,我还要选择:Force Update of Releases/Snapshot 和 Update project configuration from pom.xml。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-02
  • 1970-01-01
  • 1970-01-01
  • 2012-11-04
  • 2011-10-08
相关资源
最近更新 更多