16

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: https://i.stack.imgur.com/EnsOw.jpg

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.

Kevin Regenrek
  • 842
  • 2
  • 8
  • 17

3 Answers3

3

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

  • I think thats not the problem. I really don't want to use the master branch I want to use the tags which exists in the repository. And I don't know why 0.0.6 exists but 0.0.9 not. But both Tags are in the repository... – Kevin Regenrek Aug 01 '17 at 12:14
  • After all you have to create the tag from a specific branch. Also take a look at the question which i sent the link. That's about using tags as version numbers. –  Aug 01 '17 at 12:21
  • Hi yes this should work but it doesn't. I was inspecting the links already before. Thank you but doesn't explain why tag '0.0.6' works and 0.0.9 not. Look at my edit screenshot in the thread – Kevin Regenrek Aug 01 '17 at 12:40
3

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.

yergo
  • 4,761
  • 2
  • 19
  • 41
1

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

Kevin Regenrek
  • 842
  • 2
  • 8
  • 17