更新JDK版本后,我存在的项目编译错误



我的旧jdk版本是1.8,我将其更新为13。但是我的旧项目编译错误。这是我的pom配置。


<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

但是当我改成这个时:


<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>13</source>
<target>13</target>
</configuration>
</plugin>

编译正常。为什么?我无法将源/目标更改为 13,因为其他人的 sdk 是 1.8。谁可以帮助我,谢谢。

这是错误消息:


[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.367 s
[INFO] Finished at: 2019-12-25T19:16:37+08:00
[INFO] Final Memory: 15M/57M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project live-common: Compilation failure -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :live-common

定义看起来不错,也是这个网站 也许尝试 3 个选项:

1( 注释掉大部分代码,直到构建通过。 然后尝试逐块取消注释,直到找到有问题的地方。

2( 或者为版本 13 配置 IDE,并查看它是否发现错误。

3( 要使用调试级别 (-X( 运行 Maven 干净,它可能会提供有关错误的更多详细信息。

最新更新