1
votes

I have a project A with a dependency on project B. Project B had version number 1.0.0-SNAPSHOT for quite some time. After we released project B with version number 1.0.0, we removed all the old snapshots from the repository because it took way to much space on the server to keep 836 old snapshots. However, project A now fails because it can't find version 1.0.0-SNAPSHOT of project B anymore.

Question: Why does maven not consider the 1.0.0 release equally usefull as a snapshot and just take that instead?

2

2 Answers

2
votes

Well, because this is how it works and how it's designed. Actually, it's not so obvious that version 1.0.0 is version 1.0.0-SNAPSHOT but released, because there is not strong requirement for that. It's possible to have some SNAPSHOTs versions never released or have final releases of artifacts without SNAPSHOTs (because they were not deployed).

These are actually 2 different versions, so there shouldn't be automatic switch beetwen them without your permission. In fact, Maven is smart enought to guess than 1.0.0 is probably final release of 1.0.0-SNAPSHOT and suggest this during release process (by maven-release-plugin) but as long as you develop your piece of code, it does exactly what you want and you want 1.0.0-SNAPSHOT version, as you require in POM.

1
votes

Releases are just not an equivalency to a SNAPSHOT :( Snapshots are essentially 'development' builds, so Maven does not try and be smart about which one to fetch. You will either have to put a snapshot back into the repository, or change your project to depend on the release version, specifically 1.0.0.