Java compiler与installed Java project face不匹配解决方法

本文介绍了如何解决Maven编译器默认版本与实际使用版本不匹配导致的Java项目构建错误。通过更新pom.xml文件中的Maven编译插件配置,将编译器版本更改为所需版本,即可修正此问题。

1. 错误截图

075434_GJYP_1775885.png

2.原因分析

This error is because of maven compiler plugin defaults. Which is currently 1.5. So if you are using java 1.6 for building your project, you are going to face this issue every time you run this command:

3. 解决方案

To solve this issue, you need to make one time update in your pom.xml file. This update is for overriding the default compiler level in maven compiler plugin.

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

Update above compiler properties with your desired java version. And place this configuration inside “build” node in pom.xml file like this:

<build>
    <finalName>JerseyHelloWorld</finalName>
    <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
        </plugin>
  </plugins>
</build>

Above change will correct the error.


引用:Solved: Java compiler level does not match the version of the installed Java project facet

转载于:https://my.oschina.net/KingPan/blog/499141

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值