I am having some trouble with using a specific branch as a dependency in my project.
I have one reposityry I'll call repositoryA
which is the project I'm woring on, and repositoryB
which is a different repository upon which repositoryA
depends.
However, I have a specific branch in repositoryB
named "1.0" that I want to specify for composer to use.
What I have tried in repositoryA
is to, in composer.json, specify the following as a requirement (treat this as though each line is in different attempts, not in the same file/attempt):
// ...
"my-vendor/repositoryB": "1.0-dev",
"my-vendor/repositoryB": "1.0.x-dev",
"my-vendor/repositoryB": "dev-1.0",
"my-vendor/repositoryB": "dev-1.0.x",
"my-vendor/repositoryB": "1.0",
"my-vendor/repositoryB": "1.0.x",
// ...
When I try to set these constraints, then the error message I'm getting is:
The requested package my-vendor/repositoryB 1.0.x-dev exists as
my-vendor/repositoryB[dev-master] but these are rejected by your constraint.
After googling this issue for a bit, it seemed like I need an alias for the "1.0"-branch for it to worked, so I also tried adding the following to the composer.json in repositoryB
:
//...
"extra": {
"branch-alias": {
"1.0-dev": "1.0.x-dev"
}
}
//...
What is it I'm misunderstanding in how this works?
I found a solution:
Turns out that I could get it to work by first updating the branch in composer.lock
to 1.0.x-dev
manually before running composer update
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With