Publish maven sources artifact/package (with Do not allow duplicates)

Using hosted GitLab (14.4.0-pre)

We want to have the ‘Do not allow duplicates’ setting enabled (with an exception for *.-SNAPSHOT) to prevent overwriting of a release maven artifact.

When we add sources generation to our Maven build, it fails to push the sources jar to GitLab (error is 400).

So these files upload successfully:


But this artifact fails:


This is clearly a different artifact, so I’m not understanding why GitLab rejects it.

If I change the Maven packages setting to allow duplicates, then it works. However, this sets us up for risk if a developer forgets to update the version in the pom.

Any guidance?