idea自动重置language level和java compiler解决办法:修改setting

maven工程:
错误: -source 1.6 中不支持 diamond 运算符。
尝试按网的的方式修改后,自动恢复,也在pom文件指定版本,依然不行。
后来发现:pom这样配置了:
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.source}</target>
                </configuration>
            </plugin>

  写死1.8还是失败。

最后,发现是引用的setting.xml文件上面配置了1.6,改为1.8即可。

<profile>
        <id>jdk-1.8</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
    </profile>

  

 

原文地址:https://www.cnblogs.com/phpli/p/10599059.html