Hi, I’ve been trying to run a scheduled task to test snapshot removal but until now I can’t seem to get it working.
I’ve uploaded release and snapshot artifacts with curl into respective release and snapshot repos.
It’s not working with standard naming and neither with timestamps added to snapshot artifacts.
We version our snapshots with <git_branchname>-SNAPSHOT in the build using mvn versions:set.
With a git branch called test-branch my lp-dummy-ga snapshot artifacts ends up stored like this in Nexus: com/acme/lp-dummy/lp-dummy-ga/test-branch-SNAPSHOT/lp-dummy-ga-test-branch-20210907.024713-13.jar
i.e. the version part is different in the path and in the artifact name.
That means in Nexus we get one folder per branch (like test-branch-SNAPSHOT) containing one or more datetime-stamped snapshots.
The Remove Snapshots From Repository task does not clean in the desired way. It has Minimum snapshot count = 1. But it leaves one snapshot artifact per version folder, not per artifact. After a few years of coding there are over 1000 of these version folders and thus thousands of irrelevant artifacts. Not expected, not desired.
Is this working as intended from nexus side?
I don’t really understand how the storage format in Nexus is decided. In the mvn install step in the build the artifact is put in: <m2_repo>/som/acme/lp-dummy/lp-dummy-ga/test-branch-SNAPSHOT/lp-dummy-ga-test-branch-SNAPSHOT.jar
Next, in the mvn deploy it says:
Downloaded from aza.nexus: http://nexus.aza.se/content/repositories/snapshots/com/acme/lp-dummy/lp-dummy-ga/test-branch-SNAPSHOT/maven-metadata.xml
...
Uploaded to aza.nexus: http://nexus.aza.se/content/repositories/snapshots/com/acme/lp-dummy/lp-dummy-ga/test-branch-SNAPSHOT/lp-dummy-ga-test-branch-20210906.024720-12.jar