Fatal error compiling: invalid target release: 17 -> [Help 1]

文章描述了一个在使用Maven编译项目时遇到的错误,错误信息提示目标发行版17无效。尽管尝试将Maven配置文件中的源和目标版本设置为1.8,但由于项目依赖的其他包是用JDK17编译的,导致构建仍然失败。最终解决方案是将开发环境的JDK从8升级到17,以匹配项目的编译需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Fatal error compiling: 无效的目标发行版 : 17   -> [Help 1]

Fatal error compiling: invalid target release: 17 -> [Help 1]

===

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

<build>  
    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <version>2.0.2</version>  
            <configuration>  
                <source>1.8</source>  
                <target>1.8</target>  
            </configuration>  
        </plugin>  
    </plugins>  
</build> 

修改完成以后,项目依然不可用,因为该项目引用的其他包也是由17编译的,因此我构建依然失败,最终不得以JDK8  升级到  JDK17

[INFO] merita-dependencies ................................ SUCCESS [ 0.005 s] [INFO] merita-framework ................................... SUCCESS [ 0.004 s] [INFO] merita-gateway ..................................... FAILURE [ 0.342 s] [INFO] merita-modules ..................................... SKIPPED [INFO] merita-infra ....................................... SKIPPED [INFO] merita-log ......................................... SKIPPED [INFO] merita-system 1.0.0 ................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.393 s [INFO] Finished at: 2025-05-12T10:00:16Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project merita-gateway: Fatal error compiling: invalid target release: 17 -> [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 [ERROR] mvn <goals> -rf :merita-gateway /app #
最新发布
05-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值