[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ppedap-registry: Fatal error compiling: invalid target release: 11 -> [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
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
在Jenkins打包时候出现如上图的错误,maven-compiler-plugin该插件无法下载,但是我这个项目的pom文件中已经配置了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
所以说并不是没有引入依赖造成的,所以继续分析:
因为该插件的作用是告诉项目我们现在使用的是jdk什么版本,因此恍然大悟,我在Jenkins容器中安装了jdk11和jdk8,但是在Jenkins中配置该项目的时候还是选择了jdk8,这样就造成了项目的jdk和Jenkins的jdk版本不一致。
因此修改如下即可: