简体   繁体   English

从Maven到Eclipse(m2e)会忽略开普勒POM文件中的编译器版本设置

[英]Maven to Eclipse (m2e) ignores compiler version setting in POM file in Kepler

Many people have posted complaints that m2e resets their compiler settings to 1.5. 许多人抱怨说m2e将其编译器设置重置为1.5。 The answer to these complaints is often to set the source and target levels as shown as below: 这些投诉的答案通常是设置源和目标级别,如下所示:

<plugins>
    <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
</plugins>

I am using Eclipse Kepler which come with m2e built in, and this does not work for me. 我正在使用内置有m2e的Eclipse Kepler,这对我不起作用。 I've checked for updates to m2e and there are none. 我已经检查了m2e的更新,但是没有更新。 Every time I select Maven > Update Project, my compiler version gets set back to 1.5 and I have to open the project setting and reset it to 1.7. 每次我选择“ Maven”>“更新项目”时,我的编译器版本都将设置为1.5,并且我必须打开项目设置并将其重置为1.7。

Is there something else that needs to be done or is this a bug in m2e for Kepler? 还有其他需要完成的工作吗?或者这是开普勒m2e中的错误吗?

Have you set it within the pluginManagement-tag? 您是否在pluginManagement-tag中设置了它?

<build>
  <pluginManagement>
     <plugins>
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.1</version>
           <configuration>
              <source>1.7</source>
              <target>1.7</target>
           </configuration>
        </plugin>
     </plugins>
  </pluginManagement>
</build>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM