我知道这已经被问过好几次了,但其他解决方案对我不起作用,所以问题可能出在其他地方。
在一个依赖项目中,我需要一个这样的包:
"require": {
"drupal/security_review": "dev-8.x-1.x#35ebae44"
}
但是
composer update
失败的原因:package/name dev-master requires drupal/security_review dev-8.x-1.x#35ebae44
-> no matching package found.
出于研究目的,我获取了包信息:
[local]$ composer show --all drupal/security_review
name : drupal/security_review
descrip. : Site security and configuration review module.
keywords :
versions : 1.x-dev, dev-1.x
type : drupal-module
source : [git] https://git.drupal.org/project/security_review 9a3bdf82a645dabb9801f73d2d76acf8c3081d88
support
source : http://cgit.drupalcode.org/security_review
requires
drupal/core ~8.0
然后尝试使用版本代替分支,因为它作为前缀从版本中省略“dev-”部分:
"require": {
"drupal/security_review": "dev-1.x#35ebae44"
}
情况有所不同:
[local]$ composer update
...
- Installing drupal/security_review (dev-1.x 9a3bdf8): Cloning 9a3bdf82a6
如您所见,它获取提交 #9a3bdf8 而不是请求的 - #35ebae44。
有任何想法吗?
最佳答案
也需要弄清楚这一点,它是 1.x-dev
而不是 dev-1.x
例如:
composer require drupal/security_review:1.x-dev#35ebae44
1/2: http://packagist.org/p/provider-latest$00ceddb9dc4b7174d6c84c3e2ac454ccd6a6cb952ab70c1ab623371566d63754.json
2/2: http://packagist.org/p/provider-2018-04$1ce22045b6ddc998c850721c3db7f2902d0d37ae5989b30f0fb40ebfa5e91833.json
Finished: success: 2, skipped: 0, failure: 0, total: 2
./composer.json has been updated
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
Gathering patches for root package.
- Installing drupal/security_review (dev-1.x 35ebae44): Gathering patches for dependencies. This might take a minute.
Cloning 35ebae44 from cache
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
关于composer-php - 如何要求 Drupal 项目的特定提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48943258/