markthegrea
markthegrea

Reputation: 3851

Best practice for using dates as versions in Maven

We are creating a jar that fetches descriptions for ECUs and Faults codes.

DescriptionFinder finder = new DescriptionFinder();
String response = finder.findEcmDesc("43"); 

The descriptions get loaded from a big property file that is maintained by some engineers. This property file gets updated 3 times a year.

This is a standalone jar and we want to update it 3 times a year and think a date for a version is a good idea.

 <artifactId>pfm-common-descriptions</artifactId>
 <version>2020.5.1</version>
 <name>pfm-common-descriptions</name>

Pretty much every thing I read says it is best practice to not use a date, but I am pretty sure this is the instance when it is a good thing. We want our users to upgrade to the latest jar. This would be a visual reminder to do that if it is too old.

Here are some of my ideas:

I'm guessing our customers could use the RELEASE keyword:

<dependency>
  <groupId>blah.blah.blah</groupId>
  <artifactId>pfm-common-descriptions</artifactId>
  <version>RELEASE</version> **(this has actually been deprecated!)**
</dependency>

But they may not. And a date would still be a great indicator of age. We are setting up notifications as to when JFrog (our maven repo) gets a change.

Thoughts? Should I add a version to the date? What format do you use?

Upvotes: 1

Views: 894

Answers (1)

Mikhail Kopylov
Mikhail Kopylov

Reputation: 2058

In general, best practice is to use semver for versions. But some don't do that.

If you follow semver, it would be nice to keep track on what has changed, have kind of CHANGELOG.md so that your users can be aware of what new things are added to a new version and make a decision if it's worth updating.

Having a date in version doesn't really add too much sense, from my point of view.

Add a notification when a new version comes? It may be done with semver.

Make them aware of how old is their current version? Each jar has this meta information, and a user can open your CHANGELOG.md and see what was added since their current version is released.

So I don't see any reasons why semver doesn't fit here.

Upvotes: 1

Related Questions