Java找不到符号解决

1. 项目一直报找不到符号,导致无法启动。
在这里插入图片描述
2. 解决方案一
清除idea缓存
在这里插入图片描述
在这里插入图片描述
重新编译打包再运行。

3. 解决方案二
在项目文件夹下删除以下文件
在这里插入图片描述
然后重新打开进行maven clean package即可。

  1. 解决方案三
    有可能是maven编译时使用的jdk版本不对导致,需要在pom文件中加入:
    位置在build -> plugins
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>11</source>
        <target>11</target>
    </configuration>
</plugin>

猜你喜欢

转载自blog.csdn.net/qq_38747892/article/details/131132138