不支持发布版本 1.8

我有一个使用 Java 8 的项目。


到目前为止,在 pom 中我们将源和目标版本指定为 1.8:


<maven.compiler.source>1.8</maven.compiler.source>

<maven.compiler.target>1.8</maven.compiler.target>

我们想利用 Java 9+ 的“-release”选项并添加以下内容:


<maven.compiler.release>1.8</maven.compiler.release>

但是现在我们收到以下错误:


Fatal error compiling: release version 1.8 not supported

我们使用 maven 3.5.3、3.8.0 版中的 maven-compiler-plugin 和 Java 10 来编译项目。


这里有什么问题?


守候你守候我
浏览 256回答 2
2回答

浮云间

这应该工作<maven.compiler.release>8</maven.compiler.release>因为该<release>属性仅适用于发行版的主要版本。通过,这是假设这是实际编译器插件配置中使用的参数的方式,有点像:<plugin>&nbsp; &nbsp; <groupId>org.apache.maven.plugins</groupId>&nbsp; &nbsp; <artifactId>maven-compiler-plugin</artifactId>&nbsp; &nbsp; <version>3.8.0</version>&nbsp; &nbsp; <configuration>&nbsp; &nbsp; &nbsp; &nbsp; <release>${maven.compiler.release}</release>&nbsp; &nbsp; </configuration></plugin>

慕桂英3389331

就我而言,我不得不更改版本、源和目标。&nbsp; <properties>&nbsp; &nbsp; <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>&nbsp; &nbsp; <maven.compiler.release>8</maven.compiler.release>&nbsp; &nbsp; <maven.compiler.source>8</maven.compiler.source>&nbsp; &nbsp; <maven.compiler.target>8</maven.compiler.target>&nbsp; </properties>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java