0

I'm working as a consultant for a customer that uses Java components. I am not that familiar with Maven, they do some stuff that I don't think is correct or as it should be. For instance, they release by copying the code to an entirely different system, removing -SNAPSHOT everywhere and then releasing it from there.

So my question is, what is the textbook way of handling -SNAPSHOT in POMs?

More specifically what is typically checked into source control on what branch? Are -SNAPSHOT POMs checked into source control on a feature branch after incrementing and removed before merging to trunk or release branches?

DanDan
  • 741
  • 2
  • 10
  • 22
  • 1
    https://stackoverflow.com/questions/5901378/what-exactly-is-a-maven-snapshot-and-why-do-we-need-it#:~:text=A%20snapshot%20version%20in%20Maven,basically%20%22%201.0%20under%20development%22. – Rakesh Nair Dec 02 '21 at 12:16
  • That looks like a common maven workflow but with extra steps and doing some things manually that can be done through maven.. – LinFelix Dec 02 '21 at 12:17
  • There is a [maven version plugin](https://www.mojohaus.org/versions-maven-plugin/) that helps you working with changing version scattered around in `pom.xml` files. For instance `mvn versions:set -DnewVersion=1.0.3` will change all version properties to 1.0.3 without manual intervention. There is also another [maven release plugin](http://maven.apache.org/maven-release/maven-release-plugin/) that can help you when releasing a new version of your code (version properties and repository stuff). – usuario Dec 02 '21 at 12:28
  • @RakeshNair Thanks! That's what I was looking for – DanDan Dec 02 '21 at 12:56
  • Does this answer your question? [What exactly is a Maven Snapshot and why do we need it?](https://stackoverflow.com/questions/5901378/what-exactly-is-a-maven-snapshot-and-why-do-we-need-it) – royB Dec 02 '21 at 13:43
  • @royB It's certainly helpful, but not really answering my main concern. I'm mainly interested in what version of a POM (with or without snapshot) to commit on what branch (typically) – DanDan Dec 02 '21 at 13:51
  • 2
    That is unanswerable in general, as it depends on the workflow, and the meaning of the branches. – Mark Rotteveel Dec 02 '21 at 13:54

0 Answers0