I have a shared dependency as follows –
<groupId>common.spring</groupId>
<artifactId>spring</artifactId>
<version>3.0</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
I then reference this dependency using :
<dependency>
<groupId>common.spring</groupId>
<artifactId>spring</artifactId>
<version>3.0</version>
<type>pom</type>
</dependency>
I’m using spring version 3.0, is it common practice to set the to same. So this will work as long as the tags match. But should I use the version of spring I am using in the tag, what is common convention ?
Common convention is to have a root pom, defining the version, and then leaving the version information out in your project poms so they will pick up the one from root pom.
Often, Spring is a kind of special case as it has multiple modules that you’d want to have the same version, so something like
and
in the root pom is what we use. In the project pom it would be then like this:
However, if Spring is regarded just as a regular module, it would be just
in the dependencies section in the root pom, and
on project pom.