Dependency Management
Last updated
Was this helpful?
Last updated
Was this helpful?
This is already covered in the Maven documentation and many tutorials.
Some rules:
Never use snapshots in releases
Ensure version convergence
Handling dependencies includes controlling the versions of those dependencies. Maven allows doing so without actually including the versions into the project.
This is handled with the and options.
This way if the dependencies are added into any kind of children POM the version is already set by default. Which is very useful when creating base POMs or working with multi-module projects.
Development releases are snapshots. These are handled by adding the -SNAPSHOT suffix to a version in the POM:
The generated JAR will be timestamped, and can be stored into a repository like any dependency.
When using the snapshot version as a dependency Maven will download the latest snapshot.
A BOM project just contains a POM with a set of dependencies. This allows enforcing a predefined configuration which reduces the problems caused by complex dependencies.
They can be used through the dependency management configuration:
To check if there are newer versions for the dependencies use the following command:
Sometimes you need to delete and download again all the dependencies. This may be caused by the use of snapshots.
This command will do so:
To remove only snapshots: