2014-04-16 130 views
2

目前我的项目通过版本SVN,它也使用Composer来控制依赖关系。 在我的一个项目中,我试图将另一个项目设置为我的依赖项,但我无法完成。安装本地svn依赖作曲家

在我的主要项目中,我正在尝试设置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

任何建议来解决这个问题?我要离开去执行一些配置?

回答

6

经过一番研究,我发现了一个参数composer.json必须设置:
主项目依赖设置它之后已成功下载。
我的文件如下:

主要项目:

 
{ 
    "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.*" 
    } 
}