Maven best practices: including timestamps for snapshot releases or not?

I recently added the ability to create Maven snapshots for a project configured to use a unique version of timestamp on a deployed artifact. But there is some confusion as to whether to do it right (the snapshots in question are being deployed in one of the public repositories, and not just inside an organization such as a company): some say that this causes problems when trying to use snapshots .

So: considering how much of Maven is agreement-based, and following accepted best practices, I hope there are some recommendations as to which option to choose.

(NOTE: I edited the title a bit. I am particularly interested in the benefits (or lack thereof) of enabling a unique timestamp using the deployment option for public versions of snapshots, and not so much for using timestamps if included, although this is obviously somewhat related question)

+4
source share
2 answers

Generally, you should always build against the -SNAPSHOT dependency. However, you should not release your product if it includes -SNAPSHOT dependencies. If you use the Maven Release Plug-in to automate the release, it will verify that you are not using plugins or release dependencies.

But this is not always possible. In cases where I need to release something based on a snapshot assembly, when I use an explicit tag / assembly number, rather than the version naming scheme -SNAPSHOT.

You can automate this using Maven Plugin Versions . It provides targets for locking and unlocking snapshot versions in your POM.

+1
source

The whole point of the snapshot is to let someone use the latest version of the code. Why do you want to use a snapshot of five versions?

Given this, what timestamps in the artifact name do you buy?

I have been using Maven for about 5 years now. I have never seen a flash drive with a timestamp in the name.

0
source

Source: https://habr.com/ru/post/1286485/


All Articles