两种可行的方法

方法1. 设置属性,指定编译的版本

在pom文件的根节点加上

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

方法2. 在maven编译插件指定编译的版本

在pom文件的根节点加上

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

相关文章:

  • 2021-12-18
  • 2021-08-23
  • 2021-11-18
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-06-09
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2021-07-21
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-09-17
相关资源
相似解决方案