9

Composer 在我的 json 文件中提供的存储库中找不到我要从中克隆的分支。我得到的错误是:

 [UnexpectedValueException]
 Could not parse version constraint development: Invalid version string "dev
 elopment"

我想我不能说,去这个位置,从这个分支克隆?

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "development"
    }
}
4

2 回答 2

8

你只是语法错误。您需要告诉 Composer 使用一个分支,然后是分支名称。所以而不是:

"require": {
    "AdamKyle/Aisis-Core": "development"
}

假设您的分支被称为“开发”,它应该是

"require": {
    "AdamKyle/Aisis-Core": "dev-development as 2.0.0"
}

2.0.0'as' 右侧的别名是您的分支的别名。这允许 Composer 将您的分支视为满足AdamKyle/Aisis-Core项目中的任何其他要求,您的分支版本为 2.0.0 版。

于 2013-09-21T17:10:16.947 回答
6

Just ran into this problem myself. I think the correct approach is to reference the branch under source and then give it a version of dev-branch:

{
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "AdamKyle/Aisis-Core",
                "version":"dev-development",
                "source": {
                    "url": "https://github.com/AdamKyle/Aisis-Core.git",
                    "type": "git",
                    "reference":"development"
                }
            }
        }
    ],
    "require": {
        "AdamKyle/Aisis-Core": "dev-development"
    }
}
于 2014-05-23T12:28:07.537 回答