25

我在我的开发环境中使用 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>

4

6 回答 6

77

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

  1. 转到包资源管理器
  2. 右键单击项目
  3. 选择 Maven\更新项目
于 2013-09-02T13:02:19.797 回答
10

当我将 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中更改了编译器的配置,之前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>

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

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

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

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

或者

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

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

Eclipse 中的问题视图

于 2014-02-05T04:57:04.460 回答
4

1- 单击 alt + F5

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

3-好的。

于 2016-07-25T11:21:41.813 回答
1

以下步骤对我有用:

  1. 在 Eclipse 中关闭项目。
  2. 删除 Eclipse 中的项目(但不删除内容)。
  3. 导航到文件系统中的项目并删除 .classpath 和 .project 文件。
  4. 返回 Eclipse 并将项目作为“现有 maven 项目”导入。
于 2015-11-23T10:28:42.730 回答
0

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

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

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

于 2020-09-07T15:53:12.360 回答
0

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

它在 STS 中运行良好。

于 2016-02-22T05:59:15.733 回答