gha_build.sh ignores failures of the archetype's own mvn install

未關閉 適合新手
#1,715 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
88/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
bash, github-actions, java

研究方向

從 gha_build.sh 開始,檢查 archetype 函式,尤其是 mvn -q clean install 步驟和後續的 mvn archetype:generate 呼叫。查看相鄰步驟如何處理命令失敗。當 archetype 安裝失敗時,指令碼會結束,而不是從快取的 archetype 產生專案,這就算完成;執行安裝失敗的指令碼以確認這一點。

由索引模型根據 Issue 內容生成。

描述

In gha_build.sh, the archetype function runs mvn -q clean install in the archetype module but doesn't check its exit code. The next step, mvn archetype:generate -DarchetypeCatalog=local, then generates from whatever version of the archetype is in the local catalog.

So when the archetype's integration test fails:

  • On a clean machine, which is CI today since setup-java has no Maven cache, nothing is in the local catalog and generate fails with "The desired archetype does not exist". The job goes red, but the error points at the wrong step.
  • On a machine that has installed an older archetype before (any dev machine, or CI if Maven caching is turned on later), generate quietly uses the old archetype and the run passes. The new archetype is never tested.

Releases aren't affected: release.yml runs mvn release:prepare/perform over the full reactor, which runs the archetype integration tests and stops on failure.

This came up in #1714. The springboot4 archetype's integration test failed with NoClassDefFoundError for JsonApplyView, and a local gha_build.sh run still reported success because it generated from a cached 3.0.3-SNAPSHOT archetype.

Suggested fix: check the exit code after the archetype install, like the other steps do.

cd ${WORKING_DIR}/${ARCHETYPE_NAME} && mvn -q clean install
if [[ "$?" -ne 0 ]]; then
    exit 1
fi

Passing -DarchetypeVersion with the project version to archetype:generate would also stop it from falling back to an older archetype.

主要語言
Java
星號
1.6k
分支
575
平均合併
1 天 15 小時
30 天內合併 PR
12

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

aws/serverless-java-container 的其他 Issue

查看 aws/serverless-java-container 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。