Composer 不会在私有存储库中加载私有存储库? [英] Composer won't load private repository within private repository?

查看:19
本文介绍了Composer 不会在私有存储库中加载私有存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试利用 composer 包的强大功能来使我的应用程序更加模块化.因此,我的主要应用程序现在依赖于我正在拉入的私有存储库,如下所示:

So I am trying to leverage the power of composer packages to make my application more modular. So my main application is now depending on a private repository which I am pulling in like so:

"repositories": [
    {
        "type": "vcs",
        "url": "../tenant-package.git"
    }
],
"require": {
    "archiveonline/tenant-package": "dev-master#a9ee4ec"
},

这很好用,它会在本地拉入 tenant-package,如果我将 url 更新为 bitbucket url,它仍然可以正常工作.现在 tenant-package 有另一个名为 repository-package 的私有依赖项,我将其拉入 tenant-package ,如下所示:

This works well and it pulls in the tenant-package locally and if I update the url to a bitbucket url, it still works fine. Now the tenant-package has another private dependency called repository-package which I pull in the tenant-package like so:

"repositories": [
    {
        "type": "vcs",
        "url": "https://rohan0793@bitbucket.org/archiveonline/repository-package.git"
    }
],
"require": {
    "archiveonline/repository-package": "dev-master#e4ce518"
},

现在,当我在 tenant-package 中执行 composer update 时,我可以查看供应商目录以找到 archiveonline/repository-package.同样,当我在主应用程序中执行 composer update 时,我可以在供应商目录中找到 archiveonline/tenant-package 但找不到 archiveonline/repository-package.我究竟做错了什么?我错过了什么吗?这不是办法吗?

Now when I do a composer update in tenant-package, I can look into the vendor directory to find archiveonline/repository-package. Similarly when I do a composer update in my main application, I can find archiveonline/tenant-package in the vendor directory but I cannot find archiveonline/repository-package. What am I doing wrong? Am I missing something? Is this not the way to do it?

推荐答案

Composer 在决定哪些包可用之前必须了解所有可能的存储库.默认情况下,只有 packagist.org 在列表中并且知道所有公开发布的包.

Composer has to know about all possible repositories before deciding which packages are available. By default, only packagist.org is on the list and knows about all publicly published packages.

如果您想添加单独的存储库,您必须将它们全部添加到根包中.您不能间接使用根包中所需的包中提到的存储库.

If you want to add individual repositories, you have to add them all into the root package. You cannot use repositories that are mentioned in packages you require in the root package indirectly.

Composer 将扫描所有存储库以获取有关任何包含包的信息,但如果它允许间接包链接,那么如果一个包指向一长串其他包(如果包含在您使用的公共包中),否则它将递归地继续查找具有指向其他存储库的新链接的新存储库等.

Composer will scan the all repositories for information about any included packages, but if it would allow indirect package links, this search might never end if a package either points to a long list of other packages (a very evil denial of service if included in a public package you use), or it will recursively continue to find new repositories with new links to other repositories and so on.

设计决定只使用根包 composer.json 的存储库知识,因此必须提及所有 Git 存储库.

The design decision was being made to only use the repository knowledge of the root package composer.json, so that is where all your Git repos would have to be mentioned.

您可以想象,这很乏味,所以有一些帮助:满足.您将其配置为了解您的所有存储库,并且它将在一个地方收集它找到的所有元数据.运行它会创建一些静态文件,您必须通过 HTTP 或 HTTPS 提供这些文件,然后您在所有 composer.json 文件中使用 "type":"composer" 指向此位置,"url": "http://example.com/your/satis/path".

As you can imagine, this is tedious, so there is some help: Satis. You'd configure it to know about all your repositories, and it will collect all meta data it finds in one place. Running it creates some static files that you'd have to serve via HTTP or HTTPS, and you point to this location in all your composer.json files with "type":"composer", "url": "http://example.com/your/satis/path".

每当您添加新包或新包的新版本时,在 Satis 更新元数据文件后,Composer 将了解它们并允许从任何位置添加最新(非冲突)版本的任何包.

Whenever you add a new package or new version of a new package, after Satis updated the meta data files, Composer will know about them and allow adding any package from anywhere in the most recent (non-conflicting) version.

这篇关于Composer 不会在私有存储库中加载私有存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆