2014-04-16 169 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.*" 
    } 
}