You must publish snapshot and release artifacts without overwriting a released version.
IntermediateScenarioBuilds, Artifacts, Nexus, SonarQube and Testing
Answer
Situation read → Release immutability.
What I'd do →
- Create separate Nexus hosted repos:
maven-snapshots(version policy Snapshot) andmaven-releases(Release, deployment policy "Disable redeploy"). - Configure
distributionManagementin the POM for both and usemvn deploy. - Use CI credentials with deploy rights only on those repos.
Why → A released version that can change breaks reproducibility and trust.
Interview tip → "Released artifacts are immutable; snapshots are not."
More on Builds, Artifacts, Nexus, SonarQube and Testing
A Maven project resolves dependencies from Maven Central on every build and a left-pad style outage would stop all builds.BeginnerEvery merge to main should produce a unique semantic version automatically.IntermediateAn npm build is non-reproducible: different versions install on different days.BeginnerThe SonarQube quality gate must block merging PRs that add new bugs, vulnerabilities or uncovered code.IntermediateCoverage shows 0% in SonarQube although tests run in CI.IntermediateA big legacy codebase fails every Sonar gate. Teams ignore the tool. How do you adopt it?Intermediate