maven jdk 版本配置

方式一:settings.xml 配置

打开项目目录下conf/settings.xml,找到 <profiles> 节点,添加如下代码

<profiles>
  <profile>
    <id>development</id>
    <activation>
      <jdk>1.8</jdk>
      <activeByDefault>true</activeByDefault>
    </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>
</profiles>

方式二:pom.xml 配置,配置完成后,需要执行一次更新项目配置的动作。选中项目 --> 右键 --> Maven --> Update Project

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

猜你喜欢

转载自blog.csdn.net/tangbin0505/article/details/82820717