zoukankan      html  css  js  c++  java
  • (default-compile) on project app: Fatal error compiling: 无效的标记: --release -> [Help 1]

    <plugins>
    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    <configuration>
    <release>8</release>
    </configuration>
    </plugin>
    </plugins>

    如果你的pom.xml文件如上所示,并且使用jdk8,则会报错

    (default-compile) on project app: Fatal error compiling: 无效的标记: --release -> [Help 1]

    查阅官方文档,release Java9才支持

    http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#release

    <release>

    The -release argument for the Java compiler, supported since Java9
    • Typejava.lang.String
    • Since3.6
    • RequiredNo
    • User Propertymaven.compiler.release

    解决办法,可以设计jdk版本到Java9+,或者更改maven-compiler-plugin配置

    参考如下

    <configuration>
    <source>${maven.compiler.source}</source>
    <target>${maven.compiler.target}</target>
    <compilerArguments>
    <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
    </compilerArguments>
    <encoding>${project.build.sourceEncoding}</encoding>
    <annotationProcessorPaths>
    <path>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>${lombok.version}</version>
    </path>
    </annotationProcessorPaths>
    </configuration>

    如果没有使用 projectlombok,只用这个配置

    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    <configuration>
    <source>${maven.compiler.source}</source>
    <target>${maven.compiler.target}</target>
    <compilerArguments>
    <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
    </compilerArguments>
    <encoding>${project.build.sourceEncoding}</encoding>
    </configuration>
    </plugin>
  • 相关阅读:
    (转)SpringMVC学习总结
    Golang-函数的defer
    Golang-闭包
    Golang-匿名函数
    Golang-init()
    Golang-递归
    Golang-函数、包、变量的作用域
    Golang-for、break、continue、goto、return
    Golang-程序流程控制 if、switch
    Golang-进制、源码反码补码、位运算
  • 原文地址:https://www.cnblogs.com/exmyth/p/14245134.html
Copyright © 2011-2022 走看看