maven project to modify the JDK version

 

1. Global configuration (valid for all items)

Add the following configuration to the <profile> tag in the settings.xml file of maven:

<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>

2. Partial configuration (valid for specific items)

Add the following configuration to the project pom.xml file:

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <encoding>UTF-8</encoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
</properties>

 

Guess you like

Origin blog.csdn.net/u014225733/article/details/115304663