Intellij IDEA install/package编译项目代码时,无效的标记: --release 的解决办法

本文详细介绍了在新项目架构中遇到的编译问题,通过确保Java和SpringBoot版本兼容、配置IDEA的JDK、Java编译器和Maven设置,一步步解决--release标记无效的问题。特别提到在升级依赖和切换环境时可能遇到的挑战。

问题概述

在进行新项目架构时,遇见一个问题,编译项目框架代码,

编译打包不通过,“ 无效的标记: --release

如下图:

 解决办法

关于这个问题,对于博主来说很简单,

但这里一步一步来分析,

1、首先确保版本兼容

JAVA的版本和Spring Boot版本必须兼容,

在Spring Boot官方网站上可以查找,用那个Spring Boot的版本,那个版本的JDK与JDK的版本兼容,

或者Spring Boot的使用最低兼容的JDK版本,

例如:在Spring Boot的2.7版本以后,JDK的版本必须不低于JDK17,

如下图:

图1-1

图1-2

关于Spring Boot版本和JDK版本的兼容,可以在官网查看:

【spring-projects-spring-boot

Spring Boot 3.0Migration Guide

2、Project Structure(配置项目的JDK)

Project:JDK、Language level

Modules:Sources、Dependencies

SDKs:JDK home path

如下图:

3、Java Compiler(配置Java编译器)

Settings > Build,Execution,Deployment > Compiler > Java Compiler > Project bytecode version

如下图:

4、Build Tools(配置maven构建工具,博主是这里的Runner JRE版本兼容问题导致的)

配置Maven Importing,

Settings > Build,Execution,Deployment > Build Tools > 
Maven(Maven项目用Maven,什么项目就配置什么的打包环境) > Importing > JDK for importer
如下图:

配置Maven Runner,

Settings > Build,Execution,Deployment > Build Tools > 
Maven(Maven项目用Maven,什么项目就配置什么的打包环境) > Runner > JRE(Maven的Java Runtime Environment)
如下图:

5、测试Maven编译

如下图:

成功通过了!!!

关于这个问题,博主有很多老项目,很多老单位老项目都还处于任我行(管它怎么更新,我就停留在JDK1.8),但博主在新的架构中由于很多老项目所依赖的第三方组件包有很多漏洞,直接漏洞或者间接漏洞,如下图:

所以必须使用新版本的JDK和系列新的第三方组件包(JAR包),在工具里面就要不断切换IDEA的依赖环境,可能存在漏掉的切换项情况,就会导致这个问题。

本文参考:

spring initializr


好了,关于 Intellij IDEA install/package编译项目代码时,无效的标记: --release 的解决办法   就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,也可以给我留言哦,我会一一详细的解答的。 
歇后语:“ 共同学习,共同进步 ”,也希望大家多多关注CSND的IT社区。


作       者:华    仔
联系作者:who.seek.me@java98k.vip
来        源:优快云 (Chinese Software Developer Network)
原        文:https://blog.youkuaiyun.com/Hello_World_QWP/article/details/135452175
版权声明:本文为博主原创文章,请在转载时务必注明博文出处!
PS D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue> yarn yarn install v1.22.22 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > @rongcloud/plugin-call@5.2.3-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". warning " > @rongcloud/plugin-rtc@5.6.15-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". [4/4] Building fresh packages... [1/7] ⢀ @rongcloud/electron [7/7] ⢀ electron [3/7] ⢀ sqlite3 [-/7] ⢀ waiting... error D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.11 node-pre-gyp info using node@20.10.0 | win32 | x64 node-pre-gyp info check checked for "D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.6 and node@20.10.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.0 | win32 | x64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.0 | win32 | x64 gyp info find Python using Python version 3.6.5 found at "D:\Anaconda\python.exe" gyp http GET https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:363:14) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:384:16 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (node:child_process:430:5) gyp ERR! stack at ChildProcess.emit (node:events:514:28) gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) gyp ERR! System Windows_NT 10.0.22631 gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 gyp ERR! node -v v20.10.0 gyp ERR! node-gyp -v v8.4.1 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:514:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) node-pre-gyp ERR! System Windows_NT 10.0.22631 node-pre-gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 node-pre-gyp ERR! node -v v20.10.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\elePS D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue> yarn yarn install v1.22.22 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > @rongcloud/plugin-call@5.2.3-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". warning " > @rongcloud/plugin-rtc@5.6.15-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". [4/4] Building fresh packages... [1/7] ⢀ @rongcloud/electron [7/7] ⢀ electron [3/7] ⢀ sqlite3 [-/7] ⢀ waiting... error D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.11 node-pre-gyp info using node@20.10.0 | win32 | x64 node-pre-gyp info check checked for "D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.6 and node@20.10.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.0 | win32 | x64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.0 | win32 | x64 gyp info find Python using Python version 3.6.5 found at "D:\Anaconda\python.exe" gyp http GET https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:363:14) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:384:16 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (node:child_process:430:5) gyp ERR! stack at ChildProcess.emit (node:events:514:28) gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) gyp ERR! System Windows_NT 10.0.22631 gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 gyp ERR! node -v v20.10.0 gyp ERR! node-gyp -v v8.4.1 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:514:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) node-pre-gyp ERR! System Windows_NT 10.0.22631 node-pre-gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 node-pre-gyp ERR! node -v v20.10.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\ele
07-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TechBro华仔

日拱一卒无有尽,功不唐捐终入海

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值