報(bào)錯(cuò)信息
[ERROR] Failed to execute goal on project xxx: Could not resolve dependencies for project Failed to collect dependencies at xxx .xxx-service:jar:dev: Failed to read artifact descriptor for xxxx/maven-snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of nexus-snapshots has elapsed or updates are forced -> [Help 1]
原因分析
主模塊無(wú)法識(shí)別本地的其他依賴,默認(rèn)直接從服務(wù)器上獲取,無(wú)論通過(guò)更新maven、修改maven配置文件,檢查pom都無(wú)法解決。
解決方案
進(jìn)入IDEA設(shè)置找到Runner
選項(xiàng)
Build, Execution, Deployment --> Build Tools --> Maven --> Runner
然后將 Delegate IDE build/run actions to Maven
選項(xiàng)取消勾選
,然后點(diǎn)擊Apply
應(yīng)用保存設(shè)置即可
Delegate IDE build/run action to Maven
中文解釋:將生成和運(yùn)行操作委托給 Maven
官方解釋:Delegate build and run actions to Maven
默認(rèn)情況下,IntelliJ IDEA 使用原生 IntelliJ IDEA 構(gòu)建器來(lái)構(gòu)建 Maven 項(xiàng)目。如果您有一個(gè)純 Java 或 Kotlin 項(xiàng)目,這可能會(huì)有所幫助,因?yàn)?IntelliJ IDEA 支持增量構(gòu)建,這大大加快了構(gòu)建過(guò)程。但是,如果您的配置可以動(dòng)態(tài)更改編譯,或者您的構(gòu)建生成了具有自定義布局的工件,則 Maven 更適合構(gòu)建過(guò)程。
使用 Maven 構(gòu)建項(xiàng)目
-
在 Maven 工具窗口中單擊
。或者,從主菜單中選擇“文件”|”設(shè)置 |構(gòu)建、執(zhí)行、部署 |構(gòu)建工具 |Maven的。
-
單擊 Maven,然后從列表中選擇 Runner。
-
在“運(yùn)行器”頁(yè)上,選擇“將 IDE 生成/運(yùn)行操作委托給 maven”。
-
單擊“確定”。
-
轉(zhuǎn)到 Build |構(gòu)建項(xiàng)目 CtrlF9.IntelliJ IDEA 調(diào)用相應(yīng)的 Maven 目標(biāo)。
-
單擊
狀態(tài)欄可在“生成”工具窗口中查看同步結(jié)果。
使用 Maven 運(yùn)行和調(diào)試
選擇“Delegate IDE build/run action to Maven”后,IntelliJ IDEA 將使用 Maven 運(yùn)行和調(diào)試代碼。HotSwap 也會(huì)被觸發(fā),并且在調(diào)試過(guò)程中會(huì)重新加載類。
可以使用常規(guī)運(yùn)行和調(diào)試操作,就像在任何其他項(xiàng)目中一樣。
-
根據(jù)要使用的操作,從主菜單中選擇“運(yùn)行”|”運(yùn)行或運(yùn)行 |調(diào)試。
-
如果要調(diào)試代碼,請(qǐng)?jiān)凇斑\(yùn)行”工具窗口或“調(diào)試工具”窗口中檢查結(jié)果。例如,當(dāng)您運(yùn)行 main 方法時(shí)CtrlShiftF10在您的 Java 項(xiàng)目中,IntelliJ IDEA 使用 Maven 來(lái)運(yùn)行該類。
另外,如果是遇到Maven依賴報(bào)錯(cuò):Could not find artifact XX:pom:XX ...
可以參考另一篇文章
解決Maven依賴報(bào)錯(cuò):Could not find artifact XX:pom:XX …文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-773029.html
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-773029.html
到了這里,關(guān)于IDEA項(xiàng)目啟動(dòng)報(bào)錯(cuò):Failed to execute goal on project xxx: Could not resolve dependencies for project的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!