更新JDK版本后,我现有的项目编译错误

时间:2019-12-25 11:06:10

标签: java maven-3

我的旧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


1 个答案:

答案 0 :(得分:0)

定义也不错,this site 也许尝试3种选择:

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

2)或为版本13配置IDE,看看它是否发现错误。

3)以调试级别(-X)运行maven clean,它可能会提供有关错误的更多详细信息。

相关问题