我的项目自动部署依赖于Composer来安装所有依赖项 每次部署时,部署脚本都会请求全新安装,但composer.lock始终相同,部署之间不会发生依赖关系更改。
从版本号("twig/twig": "1.12.*"
)引用的Librairies从缓存加载。但是带有分支/提交引用("dompdf/dompdf" : "dev-master#424c235"
)的thoses总是触发git克隆到GitHub。
至于其他库,这些版本没有改变,但没有从缓存中加载。
Loading composer repositories with package information
Installing dependencies from lock file
- Installing phenx/php-font-lib (0.2.1)
Loading from cache
- Installing dompdf/dompdf (dev-master 424c235)
Cloning 424c235
- Installing endroid/qrcode (dev-master 4eb83c9)
Cloning 4eb83c9
- Installing j4mie/idiorm (v1.3.0)
Loading from cache
- Installing j4mie/paris (v1.3.0)
Loading from cache
- Installing jamesiarmes/php-ews (master edbcb65)
Cloning edbcb65
- Installing symfony/process (v2.3.1)
Loading from cache
- Installing kriswallsmith/assetic (dev-master 0a55a9b)
Cloning 0a55a9b
- Installing kriswallsmith/buzz (v0.10)
Loading from cache
- Installing psr/log (1.0.0)
Loading from cache
- Installing monolog/monolog (1.5.0)
Loading from cache
- Installing mtdowling/cron-expression (v1.0.1)
Loading from cache
- Installing respect/validation (0.4.4)
Loading from cache
- Installing ruudk/twitter-oauth (dev-master a4c0094)
Cloning a4c0094
- Installing slim/slim (2.2.0)
Loading from cache
- Installing slim/extras (2.0.1)
Loading from cache
- Installing symfony/console (v2.2.2)
Loading from cache
- Installing tedivm/jshrink (v0.5.1)
Loading from cache
- Installing twig/twig (v1.12.3)
Loading from cache
- Installing zendframework/zend-stdlib (2.1.5)
Loading from cache
- Installing zendframework/zend-authentication (2.1.5)
Loading from cache
- Installing zendframework/zend-permissions-acl (2.1.5)
Loading from cache
- Installing zendframework/zend-session (2.1.5)
Loading from cache
如何使Composer从本地缓存中获取提交引用的依赖项?
答案 0 :(得分:1)
不要从Github克隆,而是下载ZIP。更新后,标记--prefer-dist
将触发此操作。如果没有这个,那个包没有缓存条目,vendor
文件夹中只有克隆的repo,它会引入任何更改,然后检出所需的提交ID。