IDEA配置
maven JDK版本配置
apache-maven-x.x.x\conf\settings.xml文件添加如下配置
<?xml version="1.0" encoding="UTF-8"?><settings xmlns="/SETTINGS/1.0.0"xmlns:xsi="/2001/XMLSchema-instance"xsi:schemaLocation="/SETTINGS/1.0.0 /xsd/settings-1.0.0.xsd"><localRepository>E:\maven\repository</localRepository><mirrors><mirror><id>aliyun</id><mirrorOf>*</mirrorOf><name>Nexus aliyun</name><url>/nexus/content/groups/public</url></mirror></mirrors><profiles><profile><id>jdk18</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><piler.source>1.8</piler.source><piler.target>1.8</piler.target><pilerVersion>1.8</pilerVersion></properties></profile><profile><id>jdk17</id><properties><piler.source>1.7</piler.source><piler.target>1.7</piler.target><pilerVersion>1.7</pilerVersion></properties></profile></profiles></settings>
maven配置
项目pom.xml中jdk版本配置(不配置使用maven中setting.xml的默认jdk版本)
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding><compilerArguments><extdirs>lib</extdirs></compilerArguments></configuration></plugin></plugins></build>