我在本地 Gitlab 安装中有三个项目(p1、p2、p3)。项目 p1 需要 p2,项目 p2 需要 p3。
p2/composer.json 看起来像这样:
{
"name": "my-group/p2",
...
"repositories": [
{
"type": "vcs",
"url": "ssh://git@git.local.dev/my-group/p3.git"
}
],
"config": {
"gitlab-token": {
"gitlab.com": "my-token"
}
},
"require": {
"my-group/p3": "dev-develop"
}
}
命令"作曲家安装"适用于 p2 项目,没有任何问题。
p1/composer.json 看起来像:
{
"name": "my-group/p1",
...
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "ssh://git@git.local.dev/my-group/p2.git"
}
],
"config": {
"gitlab-token": {
"gitlab.com": "my-token"
}
},
"require": {
"my-group/p2": "dev-develop"
}
}
命令"作曲家安装"为项目 p1 显示以下错误消息:
$ composer install
...
Problem 1
- Installation request for my-group/p2 dev-develop -> satisfiable by my-group/p2[dev-develop].
- my-group/p2 dev-develop requires my-group/p3 dev-develop -> no matching package found.
根据 https://getcomposer.org/doc/05-repositories.md#repository,repositories
选项仅从根composer.json
进行评估。因此,如果您不通过 satis 或其他涵盖多个存储库的服务提供 p3,这将不起作用
以下 composer.json 工作:
{
"name": "my-group/p1",
...
"repositories": [
{
"type": "vcs",
"url": "ssh://git@git.local.dev/my-group/p2.git"
},
{
"type": "vcs",
"url": "ssh://git@git.local.dev/my-group/p3.git"
}
],
"config": {
"gitlab-token": {
"gitlab.com": "my-token"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"my-group/p2": "dev-develop"
}
}
问题是,我不知道项目p2需要什么,我不想将所有内部项目都放在composer.json中。