16
votes

Today I got a strange error within a composer updatewhich I can't describe myself.

{
   "repositories": {
       "my-plugin": {
           "type": "vcs",
           "url": "git@mycodebase.com:mjplug/myplugin.git"
       }
    },
   "require": {
        "my-plugin/myplugin": "0.0.9",
   }    
}

When I try composer update then I'll get

The requested package my-plugin/my-plugin 0.0.9 exists as my-plugin/my-plugin[0.0.6, 0.0.5] but these are rejected by your constraint.

But there exists tags like 0.0.7, 0.0.8, 0.0.9 in the repository. Why aren't they found?

If I set ~0.0.1 as version constraint it works because composer will install 0.0.6.

Any hints? Thank you

EDIT: Here is a Screenshot of our Bitbucket Server Instance: http://imgur.com/a/m8lRT

EDIT 2: SOLVED: In some last release I put the composer.json for some reason to a sub-directory. So this was the problem that composer couldn't find the latest tags.

3
Have you checked with why not command ? composer why-not my-plugin/my-plugin 0.0.9user3677687
There is no installed package depending on "my-plugin/my-plugin" in versions not matching 0.0.9Kevin Regenrek
You can put your "EDIT 2" as an answer and accept it, to just close the question.Alexey Shokov

3 Answers

3
votes

Composer allows using branches as versions by specifying them as dev-, so dev-master relates to master branch. If you want to specify a specific tag, it goes like

"author/package": "dev-master#v1.1.0"

Also see the link:

LINK

Reference

3
votes

As of described on Composer documentation i would update your tags to: v0.0.7, v0.0.8, v0.0.9 on your master branch. Thus should help composer follow what is said:

Composer first asks the VCS to list all available tags, then creates an internal list of available versions based on these tags. In the above example, composer's internal list includes versions 1.0, 1.0.1, 1.0.2, the beta release of 1.1, the first and second release candidates of 1.1, the final release version 1.1, etc.... (Note that Composer automatically removes the 'v' prefix in the actual tagname to get a valid final version number.

Once those tags on your master, your "my-plugin/myplugin": "0.0.9" or "my-plugin/myplugin": "0.0.*" etc should work properly.

1
votes

Because Wordpress Plugin Files need to be in a subfolder I put all files including composer.json to a subdirectory and pushed a new version.

Later I tried to install the new version inside my project and the new version(s) weren't found. This was the issue. The composer.json needs to be in root. (Stupid me)

Useful Command: composer show myplugin/myplugin