每次触发我的构建工作流时都会下载 Maven 依赖项。
Travis CI 提供了一种缓存 maven 存储库的方法。 Github 操作是否提供了允许缓存 maven 存储库的类似功能?
最佳答案
为了完整起见,这是一个如何在后续构建中缓存本地 Maven 存储库的示例:
steps:
# Typical Java workflow steps
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# Step that does that actual cache save and restore
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Step that runs the tests
- name: Run tests
run: mvn test
见 this page更多细节。
关于maven-3 - Github-actions:缓存 repo 以加速 maven 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57695362/