代码之家  ›  专栏  ›  技术社区  ›  rob

编写器将不安装私有包依赖项

  •  2
  • rob  · 技术社区  · 7 年前

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

    还有更多。

    我有一个symfony项目,其中包含一些私有包。 这些被VCS引用:

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

    这是预期的效果。但是,私有包YYYY引用了另一个私有包(让我们称之为Sub-YYYY),它也被package composer.json文件中的vcs类型引用。

    如果我运行composer安装,它将失败并显示消息:

    问题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"
            }
        ],
    }
    

    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 ?

    1 回复  |  直到 7 年前
        1
  •  3
  •   mleko    7 年前

    您必须将存储库条目添加到包中 sub-yyyy 在主项目中,as dependencies项是不可传递的。

    docs

    存储库不是递归解析的。您只能将它们添加到 你的主要作曲家.json。依赖项的存储库声明' 忽略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"
            },
            {
                "type": "vcs",
                "url": "git@sub-yyyy.git"
            }
        ]
    }