POM file Maven Dependency Injection - CheatSheet



When you depend on a plugin or a dependency, you can use the a version value of LATEST or RELEASE.
  • LATEST refers to the latest released or snapshot version of a particular artifact, the most recently deployed artifact in a particular repository. 
  • RELEASE refers to the last non-snapshot release in the repository.
  • A square bracket ( [ & ] ) means "closed" (inclusive). 
  • A parenthesis ( ( & ) ) means "open" (exclusive).
Best Practice:
In general, it is not a best practice to design software which depends on a non-specific version of an artifact. If you are developing software, you might want to use RELEASE or LATEST as a convenience so that you don't have to update version numbers when a new release of a third-party library is released. When you release software, you should always make sure that your project depends on specific versions to reduce the chances of your build or your project being affected by a software release not under your control. Use LATEST and RELEASE with caution, if at all.

Here's an example illustrating the various options. In the Maven repository, com.foo:my-foo has the following metadata:


If a dependency on that artifact is required, you have the following options


  • Declare an exact version (will always resolve to 1.0.1):
  • Declare an explicit version (will always resolve to 1.0.1 unless a collision occurs, when Maven will 
  • Declare a version range for all 1.x (will currently resolve to 1.1.1):
  • Declare an open-ended version range (will resolve to 2.0.0):
  • Declare the version as LATEST (will resolve to 2.0.0):
  • Declare the version as RELEASE (will resolve to 1.1.1):


Comments

Popular posts from this blog

Website's underlying technology for automation

XPATH for IE / internet explorer

All time good software testing books!