0

the company product has an externally tracked build number, and we want to easily correlate the product build number to the build jars. I'd like to use the same build number as the unique id of the jar publish instead of the default timestamp. Is there a way to change maven settings such that the snapshot key word can be editted to resolve to some other custom build number increments instead of generating the timestamp?

thx

Scott Chang
  • 301
  • 4
  • 11
  • The timestamp is generated during deployment which is a foundation in Maven so in other words the `-SNAPSHOT` can not that simple replaced. Apart from that a build number does not make sense to track it...Versions are better (1.0.0, 2.4.5 etc.). Which maven Version do you use? – khmarbaise Mar 22 '16 at 18:23
  • we already use the versions, but we also have build number so the format is like: {product name}.{major}.{minor}.{patch}-{buildnum}.{extension} – Scott Chang Mar 22 '16 at 18:59
  • I agree completely with what @khmarbaise has stated. I would suggest though that you could replace your version with your build number. Maven requires timestamps to see how old the SNAPSHOT version is. If you remove that how will maven know whether you have an older version in your local m2. Also maybe you should take a step back to determine if it's a good idea to circumvent the convention that maven has put in place. Is there another way to accomplish the task. Such as building a custom maven plugin to meet your needs. Just food for thought... – Matt Mar 22 '16 at 19:02
  • our use case is that build number needs to be tracked to distinguish multiple integration builds of the same version. and this build number needs to persist because we generate many different deployable form factors beyond the jar files (rpm, ova, azure, ami, etc...) – Scott Chang Mar 22 '16 at 19:03
  • what about using build number as classifier of the built artifact? as such, you would have for the same version, different classifiers (build numbers) and the artifact coordinates will keep on being unique (GAVC), tracking the build number for a particular jar – A_Di-Matteo Mar 22 '16 at 21:26
  • What do you mean by an integration build? Are you building your software a second time? If think further you building artifacts which are using your build artfiacts like 1.0.0 of a component. Now we are building a rpm from it...sou you need to define the version which is used to build the rpm so the rpm can have a different which contains the version like `1.0.0-1` which is specific to rpm's ...Or see what @A.DiMatteo suggested... – khmarbaise Mar 23 '16 at 08:48

0 Answers0