Eclipse Blue、Maven:项目配置不是最新的 pom.xml

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17418630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:47:01  来源:igfitidea点击:

Eclipse Blue, Maven: Project configuration is not up-to-date with pom.xml

eclipsemavenear

提问by Narendra Verma

I am using Eclipse Blue 10 & Maven 3 in my development environment.

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

I generally import maven projects from SVN by following below path:

我通常按​​照以下路径从 SVN 导入 maven 项目:

File > Import> SVN > Checkout Projects from SVN 

Then import all maven projects:

然后导入所有maven项目:

Right click on imported project > Maven4MyEclipse> Existing Maven Projects

I have a maven module called 'project-ear' and this module is to bind all my web applications into one ear.

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

But whenever I import EAR module as eclipse project, eclipse prompts below error in 'Problems' tab:

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

Project configuration is not up-to-date with pom.xml. Run project configuration update.

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

How to resolve this issue? I don't see any way to "Run project configuration update".

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

Please help.

请帮忙。

Pom.xml for EAR module:

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>

回答by Farskeptic

Sorry, I don't have the rep to add comment yet. stonedsquirrel (above) is right though and their answer should be voted as correct:

抱歉,我还没有代表添加评论。不过,stonedsquirrel(上图)是对的,他们的答案应该被选为正确的:

  1. Go to package explorer
  2. Right-click the project
  3. Select Maven\Update Project
  1. 转到包浏览器
  2. 右键单击项目
  3. 选择 Maven\更新项目

Worked perfectly for me.

非常适合我。

回答by UdayKiran Pulipati

I got this problem when I upgrade Java from JRE?System?Library?[JavaSE 1.6]to JRE?System?Library?[JavaSE 1.7].

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

After did like this the following error is displayed in Problemsview Project configuration is not up-to-date with pom.xml. Run project configuration update.

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

I changed the configuration of compiler in pom.xml, Previously the value of source and targetvalue is 1.6, I changed it to 1.7

我在pom.xml中修改了编译器的配置,之前value的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>

For get rid of this problem simply follow the below process.

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

SOLUTION:Right click on the project-> Maven4MyEclipse-> Update Project Configuration...

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

The below image shown you how to do in MyEclipse IDE.

下图向您展示了如何在 MyEclipse IDE 中执行操作。

Upgrade configuration of compiler in pom.xml

升级 pom.xml 中编译器的配置

or

或者

SOLUTION:Right click on the error in Problemsview -> click on Quick Fix

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

The below image shown you how to do in Eclipse IDE

下图向您展示了如何在 Eclipse IDE 中执行操作

Problems view in Eclipse

Eclipse 中的问题视图

回答by Ad Infinitum

1- Click alt + F5

1- 单击 alt + F5

2- Update Maven Project screen will come up. Here, click add out-of-date

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

3- OK.

3-好的。

回答by pch01

Below worked for me:

以下对我来说有效:

  1. Right click on project.
  2. Go to 'Maven' and click on update project.
  3. Click on Ok.
  1. 右键单击项目。
  2. 转到“Maven”并单击更新项目。
  3. 单击确定。

回答by Dhananjay Bhagwat

Below process worked for me:

以下过程对我有用:

  1. Right click on project.
  2. Go to 'Maven' and click on update project.
  3. Click on Ok.
  1. 右键单击项目。
  2. 转到“Maven”并单击更新项目。
  3. 单击确定。

回答by Mayank

The following steps worked for me:

以下步骤对我有用:

  1. Close the project in Eclipse.
  2. Delete the project in Eclipse ( but not the contents ).
  3. Navigate to the project in file system and delete .classpath and .project files.
  4. Go back to Eclipse and import the project as "existing maven project".
  1. 在 Eclipse 中关闭项目。
  2. 删除 Eclipse 中的项目(但不是内容)。
  3. 导航到文件系统中的项目并删除 .classpath 和 .project 文件。
  4. 返回 Eclipse 并将项目导入为“现有的 maven 项目”。

回答by Abhishek Singh

Take a backup of project. 1-Delete the project from workspace. 2-import the project. 3-mvn clean install

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

It works fine in STS .

它在 STS 中工作正常。

回答by Akhil Ghatiki

Right click on the project explorer and select maven and select update project.

右键单击项目资源管理器并选择 maven 并选择更新项目。