I am using the Artifactory plugin 2.6 in TeamCity to deploy Maven artifacts to Artifactory Maven repositories. I have both release (libs-release) and snapshot (libs-snapshot) repositories set up for my project. For build and deploy, everything works fantastically, snapshots and releases are correctly deployed to the appropriate repositories defined in the fields "Target repository" and "Target snapshot repository".
The problem is with the retention section. If I choose "Discard Old Builds:" and use "Max # Of Builds To Keep:", the number entered is a collective total of builds in both release and snapshot repositories.
I have max # of builds to keep set at 3
Build run 1 release (successfully deploys to libs-release maven repo)
Build run 2 snapshot (successful to libs-snapshot repo)
Build run 3 snapshot (again)
Build run 4 snapshot (again, all successful)
At this point, the release artifacts (from run 1) are deleted, even though they are in a separate repository than the last run. Because we have way more snapshot builds than release builds, using the same Max # as a total of the 2 repositories does not make sense.
Either of these options would be a suitable solution for this issue:
1) apply the current Max # rule value to each repository separately (max 3 in each repo for example)
2) give each repository its own Max # field (Max # of snapshots to keep & Max # of releases to keep)