Composer 不会安装私有包依赖项

rob*_*rob 4 symfony composer-php

首先,有一些相关的帖子并不适合我的问题。

还有一些。

我有一个包含一些私有包的 Symfony 项目。这些被vcs引用:

"repositories": [
    {
        "type": "vcs",
        "url": "git@aaaaa.git"
    },
    {
        "type": "vcs",
        "url": "git@xxxxx.git"
    },
    {
        "type": "vcs",
        "url": "git@yyyyy.git"
    }
],
Run Code Online (Sandbox Code Playgroud)

这像预期的那样工作。但是,私有包 yyyy 引用了另一个私有包(我们称之为 sub-yyyy),它也被包 composer.json 文件中的 vcs 类型引用。

如果我运行 composer install 它会失败并显示以下消息:

问题 1 - yyyy -> yyyy] 的安装请求。- yyyy 需要 sub-yyyy ^1.0.0 -> 找不到匹配的包。

潜在原因:

私有包(sub-yyyy)被v1.0.0标记,如果它在主项目的composer.json文件中就可以安装。

主项目的composer.json(需要删减):

{
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "git@aaaaa.git"
        },
        {
            "type": "vcs",
            "url": "git@xxxxx.git"
        },
        {
            "type": "vcs",
            "url": "git@yyyyy.git"
        }
    ],
}
Run Code Online (Sandbox Code Playgroud)

yyyy 包的 composer.json:

{
  "name": "yyyy",
  "type": "symfony-bundle",

  "require": {
    "sub-yyyy": "^1.0.0"
  },

  "repositories": [
    {
      "type": "vcs",
      "url": "git@sub-yyyy.git"
    }
  ],
  "minimum-stability": "dev",
}
Run Code Online (Sandbox Code Playgroud)

当我安装yyyy引用的包时,有sub-yyyy什么解决问题的想法吗?

mle*_*eko 5

您必须sub-yyyy在主项目中将存储库条目添加到包中,因为依赖项条目不可传递。

来自文档

存储库不会递归解析。您只能将它们添加到主 composer.json 中。依赖项的 composer.jsons 的存储库声明被忽略。

composer.json的主项目应该看起来像

{
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "git@aaaaa.git"
        },
        {
            "type": "vcs",
            "url": "git@xxxxx.git"
        },
        {
            "type": "vcs",
            "url": "git@yyyyy.git"
        },
        {
            "type": "vcs",
            "url": "git@sub-yyyy.git"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)