Maven项目编译版本的问题和Spring中没有导入核心包

时间:2023-03-10 00:34:07
Maven项目编译版本的问题和Spring中没有导入核心包
 idea中maven项目的编译:
方案1:maven的settings.xml中指定全局默认编译版本 <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:在pom.xml中指定项目的编译版本
方式1:plugin
方式2:properties <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build> <properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

配置代码

Maven项目编译版本的问题和Spring中没有导入核心包