【问题标题】:Eclipse Blue, Maven: Project configuration is not up-to-date with pom.xmlEclipse Blue,Maven:项目配置未与 pom.xml 保持同步
【发布时间】:2013-06-29 09:50:21
【问题描述】:

我在我的开发环境中使用 Eclipse Blue 10 和 Maven 3。

我通常通过以下路径从 SVN 导入 maven 项目:

File > Import> SVN > Checkout Projects from SVN 

然后导入所有maven项目:

Right click on imported project > Maven4MyEclipse> Existing Maven Projects

我有一个名为“project-ear”的 maven 模块,该模块用于将我所有的 Web 应用程序绑定到一只耳朵中。

但是每当我将 EAR 模块作为 eclipse 项目导入时,eclipse 在“问题”选项卡中提示以下错误:

项目配置不是最新的 pom.xml。运行项目配置更新。

如何解决这个问题?我没有看到任何“运行项目配置更新”的方法。

请帮忙。

EAR 模块的 Pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>com.company.xxx</groupId>
    <artifactId>my</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.company.xxx.ear</groupId>
<artifactId>my-ear</artifactId>
<packaging>ear</packaging>
<name>my-ear</name>

<build>
    <finalName>web-app</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <modules>
                    <webModule>
                        <groupId>com.company.xxx.myweb</groupId>
                        <artifactId>my-web</artifactId>
                        <contextRoot>/txcs</contextRoot>
                    </webModule>                        
                </modules>
                <generateApplicationXml>true</generateApplicationXml>
                <displayName>web-app</displayName>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>com.company.xxx.myweb</groupId>
        <artifactId>my-web</artifactId>
        <type>war</type>
        <version>${project.version}</version>
    </dependency>       
</dependencies>

【问题讨论】:

  • 通常是右键单击项目然后Maven=>Update project configuration 或类似的东西。不要让我的 Eclipse 在这里查看。
  • 感谢您的评论。我检查了但没有看到任何选项。

标签: eclipse maven ear


【解决方案1】:

为了确认 André Stannek 最初在 cmets 中提到的问题,以下工作可以更新您的项目:

  1. 转到包资源管理器
  2. 右键单击项目
  3. 选择 Maven\更新项目

【讨论】:

  • Maven»更新项目在 .classpath 文件中添加了太多废话:(
【解决方案2】:

当我将 Java 从 JRE System Library [JavaSE 1.6] 升级到 JRE System Library [JavaSE 1.7] 时遇到了这个问题。

这样做之后,问题视图Project configuration is not up-to-date with pom.xml. Run project configuration update中会显示以下错误。

我在pom.xml中更改了编译器的配置,之前source and target的值是1.6,我改成1.7

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

为了摆脱这个问题,只需按照以下过程。

解决方案: Right click on the project -> Maven4MyEclipse -> Update Project Configuration...

下图展示了如何在 MyEclipse IDE 中进行操作。

解决方案:问题视图中右击错误->点击Quick Fix

下图展示了如何在 Eclipse IDE 中进行操作

【讨论】:

  • 如何防止 Eclipse 在 .classpath 中添加这么多废话?在我记得的每一种情况下,添加的属性都是无用的。
【解决方案3】:

1- 点击 alt + F5

2- 将出现更新 Maven 项目屏幕。在这里,点击添加过期

3- 好的。

【讨论】:

    【解决方案4】:

    以下步骤对我有用:

    1. 在 Eclipse 中关闭项目。
    2. 在 Eclipse 中删除项目(但不删除内容)。
    3. 导航到文件系统中的项目并删除 .classpath 和 .project 文件。
    4. 回到Eclipse,将项目导入为“existing maven” 项目”。

    【讨论】:

      【解决方案5】:

      备份项目。 1-从工作区中删除项目。 2-导入项目。 3-mvn 全新安装

      在 STS 中运行良好 .

      【讨论】:

        【解决方案6】:

        如果您正在使用 Maven 项目,请尝试:

        1. 在项目中单击鼠标右键。
        2. “配置”
        3. “转换为 Maven 项目”

        该项目将转换为 Maven 项目,并将编译所有库 Java 和 Maven

        【讨论】:

          猜你喜欢
          • 2022-01-20
          • 1970-01-01
          • 2017-04-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-12-23
          • 1970-01-01
          • 2011-01-05
          相关资源
          最近更新 更多