sonatype-nexus-community / nexus-repository-composer

Composer support for the Nexus Repository Manager (work in progress!)
Eclipse Public License 1.0
216 stars 84 forks source link

Composer repository no longer updates composer2 JSON files for new versions in case if redeploys are not allowed #135

Open mamazik opened 1 year ago

mamazik commented 1 year ago

What are you trying to do?

Hello!

We use Nexus 3.42.0 with nexus-repository-composer 0.0.29. Our dev team uses it to upload packages (on each upload version is incremented), and we noticed that packages uploaded after 15.10.2022 would no longer be reflected specifically in composer2-related JSON files.

In other words, for all such packages we would see all of their versions here: https://nexus.example.com/repository/composer-hosted/p/my/package.json

But not here: https://nexus.example.com/repository/composer-hosted/p2/my/package.json

When I tried to reproduce the issue manually (which I was able to do easily) with cURL, I noticed that every upload of a new version logs the following error to nexus.log (not going to copy the whole stack trace, but let me please know if you need to see it!):

"Repository does not allow updating assets: composer-hosted"

When I attempted to enable redeploys for the repo, the issue disappeared, so it's seems as if Nexus believes that we're uploading the same version over and over, which's not the case.

On example of one of such packages we know that it started misbehaving around 15.10.2022 or so. Last time we updated Nexus and the plugin was on 30.09.2022, but after that there were at least a few "proper" uploads, so we're really curious as to what could be the cause.

What feature or behavior is this required for? Publishing Composer packages.

How could we solve this issue? (Not knowing is okay!) I thought I should check this with you guys first, although I'm pretty sure it's an issue/bug with Nexus itself. Perhaps you know what could be the issue?

Anything else? I noticed Nexus does have a somewhat similar bug, which's still not resolved.

mamazik commented 1 year ago

Hello!

Any updates please?

riubi commented 2 months ago

I faced the same problem. The bug is that %package%.json for p2 is considered part of the build, and if the "Forbid redeploy" option is set, the plugin throws an IllegalOperationException. As a solution, set the Deployment policy to "Allow redeploy." In this case, the exception doesn't appear, and the meta for v2 is generated without issues.