4

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

还有更多。

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

"repositories": [
    {
        "type": "vcs",
        "url": "git@aaaaa.git"
    },
    {
        "type": "vcs",
        "url": "git@xxxxx.git"
    },
    {
        "type": "vcs",
        "url": "git@yyyyy.git"
    }
],

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

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

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

潜在原因:

私有包(子 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"
        }
    ],
}

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",
}

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

4

1 回答 1

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"
        }
    ]
}
于 2018-07-16T07:08:37.280 回答