我是Travis CI的初学者,我正在尝试优化构建。
我使用Apache Ivy作为依赖项管理器。默认情况下,Ivy将缓存放入~/.ivy2
目录中。
为了避免下载每个版本的依赖项,我在cache
文件中设置了.travis.yml
元素,如下所示:
cache:
directories:
- ~/.ivy2
我也尝试过:
cache:
directories:
- $HOME/.ivy2
没有运气。 依赖关系不是从缓存中检索到的,而是每次都下载,如常春藤日志所说:
[ivy:retrieve] downloading https://repo1.maven.org/maven2/com/google/gwt/gwt-user/2.8.2/gwt-user-2.8.2.jar ...
[ivy:retrieve] ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (15915kB)
[ivy:retrieve] [SUCCESSFUL ] com.google.gwt#gwt-user;2.8.2!gwt-user.jar (731ms)
我也尝试递归地列出ls -R ~/.ivy2
中的Ivy缓存目录(before_script
),但是没有任何输出。
您能否告诉我如何使缓存有效?
答案 0 :(得分:0)
-避免不必要的缓存更新
before_cache:
# Cleanup the cached directories to avoid unnecessary cache updates
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
-这些目录已缓存。
cache:
directories:
- $HOME/.ivy2/cache