[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project cat-registry: Fatal error compiling: 無效的目標發行版: 1.8.0_111 -> [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/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command
這個問題很明顯是JDK1.8.0_111沒有生效,版本不一致,我們系統當中,目前配置的JDK版本號是多少?
和我們的版本號是一致的,沒有問題,然后去看項目使用的JDK是多少
從上圖可以看到,目前項目用到的版本號不統一,我們把它們統一下。
集中定義版本號:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin>
