0

I'm making a custom composer package on GitLab, for the first commits I referenced the master branch in the composer.json of my project as

"require": {
    ...    
    "owner/project": "master"
    ...
}

and it was all good, it actually downloaded my package in the vendor folder.

Now I want to start making branches for each releases, so I named my first release branch as releases/1.x and tried to reference it as

"require": {
    ...
    "owner/project": "releases/1.x"
    ...
}

but this gave me the error

[UnexpectedValueException]
Could not parse version constraint releases/1.x: Invalid version string "releases/1.x"

so I tried to inline alias it as

"require": {
    ...
    "owner/project": "dev-releases/1.x as 1.x-dev"
    ...
}

but now I got

Your requirements could not be resolved to an installable set of packages.

Problem 1
  - The requested package owner/project dev-releases/1.x as 1.x-dev exists as owner/project[dev-master] but these are rejected by your constraint.

So, how can I reference my branch in composer.json?

Composer require branch name: This question was pointed out to me, but as already said i had no problem when working with master branch

Update #1

Now i've created 2 releases on gitlab, tagging a commit from master branch as v.1.0.0 and another one from releases/1.x as 1.0, but none fo the below attempts succed

"require": {
    ...
    "owner/project": "v.1.0.0",
    "owner/project": "1.0.0",
    "owner/project": "1.1",
    ...
}

Each one gives me the same old error.

Update #2

Found this question on github and noticed that my composer.json has no version entry, so I deleted all current releases, added

"version": "1.0.1",

to my package project composer.json and created a new release with both tag name and release title v1.0.1.
Then updated my other project composer.json to match new release with owner/project: "1.0.1" but nothing changed:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package owner/project 1.0.1 exists as owner/project[dev-master] but these are rejected by your constraint.
fudo
  • 2,254
  • 4
  • 22
  • 44

0 Answers0