Let us now backtrack and try to make sense of what we did so far.
Maven coordinates are used to identify artifacts in a repository.
Here are some examples.
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.1</version>
Example: 3.2.1-98234-beta
Most often you will see either:
MajorVersion.MinorVersion.IncrementalVersion
; orMajorVersion.MinorVersion
Example: 3.2.1-SNAPSHOT
The SNAPSHOT
qualifier says that this is a development version that is likely to change.
By default, Maven will check remote repositories once per day, which is configurable.
If a dependency does not have the SNAPSHOT
qualifier, it will remain as it is unless we change it.
Maven does not define when to update the major, minor, or incremental versions.
A guideline that we can follow is the Semantic Versioning specification, which reads as follows.
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.