【发布时间】:2019-08-03 21:33:29
【问题描述】:
我有一个 Symfony 应用程序,它需要来自私有存储库的 Bundle:
{
"name": "app",
"repositories": [
{ "type": "vcs", "url": "ssh://git@XX/apm-library.git" },
{ "type": "vcs", "url": "ssh://git@XX/apm-bundle.git" }
],
"require": {
"apm-bundle": "dev-some-branch-name#354d4c6c49b1e97c81b589d8ae72301dbd99949c"
}
}
Bundle 需要来自私有存储库的库:
{
"name": "apm-bundle",
"repositories": [
{ "type": "vcs", "url": "ssh://git@XX/apm-library.git" }
],
"require": {
"apm-library": "dev-some-branch-name#12b79acef80795e5a70632867d40b82f574a5fdc"
}
}
我正在同时开发 App 和 Library,所以我所做的是(如上所示):
- 请求的 Bundle 分支版本
- 此 Bundle 分支请求库的分支版本的位置
当我尝试在应用程序中安装/更新 Bundle 时,我遇到了这个问题:
Problem 1
- Installation request for apm-bundle dev-some-branch-name#354d4c6c49b1e97c81b589d8ae72301dbd99949c -> satisfiable by apm-bundle[dev-some-branch-name].
- apm-bundle dev-some-branch-name requires apm-library dev-some-branch-name#12b79acef80795e5a70632867d40b82f574a5fdc -> no matching package found.
找不到匹配的包
似乎它不会查找这么深的“dev”分支。
当我在 Bundle 本身中进行作曲家更新时 - 它成功解析了此类版本。
我做错了什么?
【问题讨论】:
-
你的例子搞砸了——
apm-bundle需要自己,而apm-library永远不需要。是否有机会无需修改即可共享真实的composer.json文件? -
你为什么首先使用哈希作为约束?
-
@rob006,感谢您指出错字。我已经修好了。 1.我不能分享整个composer.json,但我相信我已经分享了足够多。其中没有其他配置参数。只是必需的组件,2。我正在使用哈希来处理某些提交/存储库状态。我相信这不是问题,因为它具有有效的语法。
-
在约束中使用哈希更像是一种 hack 并且有一些限制 - 我建议尝试删除它们并依靠
composer.lock来锁定依赖关系。
标签: git composer-php repository