【发布时间】:2021-08-09 15:45:39
【问题描述】:
最近我将spring批处理项目从java 8升级到了11。
它在本地运行良好,我决定推送到 Jenkins,但出现以下错误。
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project bandwidth:
Fatal error compiling: invalid flag: --release -> [Help 1]
应该是什么原因,我该如何解决?
旧设置:pom 中的 java 8
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>
<org.slf4j-version>1.6.2</org.slf4j-version>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>iso-8859-1</encoding>
</configuration>
</plugin>
新设置:pom 中的 java 11
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>
<org.slf4j-version>1.6.2</org.slf4j-version>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<encoding>iso-8859-1</encoding>
</configuration>
</plugin>
【问题讨论】:
-
也许你在这里找到解决方案:stackoverflow.com/questions/49398894/…
标签: java spring maven jenkins java-11