chenchuk
chenchuk

Reputation: 5742

Jenkins - changing pom.xml versions manually

I need to change a project version and I can do it by creating a Maven project and add Maven goal of versions:set. I can also do manually.

Question: Is there any downside of changing pom.xml versions manually (using sed/awk)?

Upvotes: 2

Views: 673

Answers (1)

A_Di-Matteo
A_Di-Matteo

Reputation: 27862

Changing the version using a Maven plugin is definitely better than a manual approach (e.g. sed/awk) for several reasons:

  • You stay within the Maven ecosystem and as such avoid undesirable and unforeseen side effects
  • The versions:set would also automatically take care of propagating the change to sub-modules, in case of multi-module Maven project, since the goal:

    Sets the current project's version and based on that change propagates that change onto any child modules as necessary.

  • You can make use of several additional options provided by the goal, like filtering (e.g. only change for certain groupId/artifactId, again in case of multi-module)
  • Maintenance wise, you have better chances to keep it solid across different versions of Maven
  • In general, if Maven (or one of its plugins) already provides the same functionality: simply don't reinvent the wheel

Upvotes: 2

Related Questions