为什么Maven会更改Eclipse项目首选项?

时间:2023-01-25 09:33:10

First of all, I'm using Ubuntu 12.04, Eclipse Juno with embebbed maven 3.0.4 (m2eclipse) and I have to work in a legacy project which I got from a SVN repositroy.

首先,我正在使用Ubuntu 12.04,Eclipse Juno和embebbed maven 3.0.4(m2eclipse),我必须参与一个遗留项目,我从SVN repositroy获得。

I'm stuck in a sort of configuration problem with Maven and Eclipse.

我遇到了Maven和Eclipse的一种配置问题。

At the first time I did a Maven > Update project and I got an "Unknown Error" of "Maven Java EE Configuration Problem" type. I checked my project's properties and I've realized that java compliance level is set to 1.5 but I have 1.6 JRE activated. Well, I've changed to 1.6 version (in Java Facet too), but when I do a Maven > Update project, my project's properties are restored to default (a.k.a. 1.5 version), and the Unknown error persists.

我第一次做Maven> Update项目时遇到了“Maven Java EE配置问题”类型的“未知错误”。我检查了项目的属性,并且我已经意识到java合规性级别设置为1.5但我已激活1.6 JRE。好吧,我已经改为1.6版本(在Java Facet中),但是当我执行Maven> Update项目时,我的项目属性将恢复为默认值(a.k.a。1.5版本),并且未知错误仍然存​​在。

My pom.xml file seems to be ok, and I also try to update project with an empty pom.xml (just with modelVersion, groupId, artifactId, version, name and url tags) and I always get the same error.

我的pom.xml文件似乎没问题,我也尝试使用空的pom.xml更新项目(仅使用modelVersion,groupId,artifactId,version,name和url标签)并且我总是得到相同的错误。

I'm really stuck. Someone has a clue?

我真的被卡住了。有人有线索吗?

1 个解决方案

#1


35  

Try specifying JDK version in pom.xml:

尝试在pom.xml中指定JDK版本:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

and then do 'Update Project Configuration'

然后执行'更新项目配置'

#1


35  

Try specifying JDK version in pom.xml:

尝试在pom.xml中指定JDK版本:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

and then do 'Update Project Configuration'

然后执行'更新项目配置'