Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependencies - version vs updates

mvnrepository usually lists "version" and "updates" for each dependency.

  1. If I'm publishing my own package, how do I specify the "updates" version
  2. Which dependancy does Maven used when resolving transitive dependencies? So if my package depends on package A, which depends of package B with - version = 1.0 and updates = 1.1. Which version of B would I get?
like image 700
EugeneMi Avatar asked Feb 12 '16 03:02

EugeneMi


People also ask

What does updates mean in Maven dependency?

It tells you whether there's an updated version of a particular dependency available and if so what the latest version is. If there's a check mark it means the library in question already uses the latest version of dependency X.

What will happen if the Maven version number of POM XML file does not match with the machine used to install?

Maven won't allow any other either. Build will fail if version is not found.

Is version mandatory in POM XML?

Each maven dependency defined in the pom must have a version either directly or indirectly for example, through dependencyManagement or parent. That being said, if the version is not given, then the version provided in the dependencyManagement or the parent pom will be used.


1 Answers

You're asking what the meaning of the information in the "Updates" column of MVNRepository's "Compile Dependencies" table is.

enter image description here

It tells you whether there's an updated version of a particular dependency available and if so what the latest version is. If there's a check mark it means the library in question already uses the latest version of dependency X. You will always get the declared version of a dependency no matter what the latest version is.

Hence, if you use valdr-bean-validation 1.1.2 (example above) you'll also get jackson-databind 2.4.0 as a transitive dependency (1st row above). 2.7.1-1 would be the latest available jackson-databind version.

Notes: I finally understand your question. It would have been helpful for you to give us a concrete example right from the start.

like image 105
Marcel Stör Avatar answered Oct 24 '22 15:10

Marcel Stör