目前我的项目通过版本SVN,它也使用Composer来控制它们的依赖关系。 在我的一个项目中,我试图将另一个项目设置为我的依赖项,但我不能这样做。
在我的主要项目中,我试图像这样设置composer.json
:
{ "name": "my/project", "description": "", "repositories": [ { "type": "svn", "url": "http://myhost.com:81/svn/Dependency/", "branches-path": "branches/", "tags-path": "tags/", "trunk-path": "trunk/" } ], "require": { "my/dependency": "1.0.0" } }
我的依赖的composer.json
:
{ "name": "my/dependency", "description": "", "version": "1.0.0", "autoload": { "psr-0": { "Hasteasy\\": "lib/" } }, "require": { "php": ">=5.3.2" }, "require-dev": { "phpunit/phpunit": "3.7.*" } }
在我运行composer install
的主项目中,会发生以下情况:
Loading composer repositories with package information Installing dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package my/dependency could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see for more details. Read for further common problems.
我可以执行主项目下载依赖的唯一方法是将存储库定义为package
,但这样作曲家不会在我的依赖项中运行composer install
。
有什么建议可以解决这个问题吗?我要离开去执行一些配置吗?
答案 0 :(得分:6)
经过一些研究后,我在composer.json
中找到了一个必须设置的参数:"minimum-stability": "dev"
在主项目中设置后,已成功下载依赖项
我的文件如下:
主要项目:
{ "name": "my/project", "description": "", "repositories": [ { "type": "svn", "url": "http://myhost.com:81/svn/Dependency/" } ], "require": { "my/dependency": "dev" }, "minimum-stability": "dev }
依赖项目:
{ "name": "my/dependency", "description": "", "version": "1.0.0", "autoload": { "psr-0": { "Hasteasy\\": "lib/" } }, "require": { "php": ">=5.3.2" }, "require-dev": { "phpunit/phpunit": "3.7.*" } }