我試圖將 gradle 快取保留在我的 GitHub 作業流程中,但它不起作用。我是 gradle 新手,正在努力找出我如何/為什么無法在專案的作業流構建之間保留 gradle 快取
在我的 GitHub作業流檔案中,我有兩個 gradle 快取。其中一個是 gradle 快取,另一個是 gradle wrapper:
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
在本地 a./gradlew clean后跟 a./gradlew build將在大約 33 秒內構建我的專案......在 GitHub 上,它需要 3 倍的時間(?):https ://github.com/jactor-rises/jactor-persistence/runs/4794532441?check_suite_focus =真
如何在 GitHub 作業流程中設定有效的依賴項快取和包裝器?
uj5u.com熱心網友回復:
不要手動配置 gradle 的快取,而是使用提供的操作。現在從我的作業流程檔案中:
- uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
cache: gradle
-action 將為 gradle 和 maven 快取,setup-java因此無需手動設定快取...
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/415956.html
標籤:
上一篇:使用gradlekts運行QuarkusTest時出現ServiceConfigurationError
下一篇:添加驗證腳本,需要設定值
