3

Possible Duplicate:
How do I tell Maven to use the latest version of a dependency?

Getting Maven Dependency. I want the latest version. Right now my pom has my firm Dependecy project in it like the following example. We are trying to find a way that we dont need the version tag in it that it will just take the latest version. Can this be done?

<dependency>
  <groupId>org.xxxx.maven.test</groupId>
  <artifactId>MavenJARTest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>
Community
  • 1
  • 1
techsjs2012
  • 1,737
  • 5
  • 25
  • 57

1 Answers1

8

We are trying to find a way that we dont need the version tag in it that it will just take the latest version

You don't really want to do this. Your build will become unreproducible and unstable just because new, buggy version of some library came out. You'll never be sure whether your fix of a half-year-old production application only changed one line in code, or maybe also upgraded 10 dependencies. One of them is no longer working, one is incompatible and one has a new security hole. You really want to take that risk?

In fact, it used to work like this for plugins (version could have been skipped), but since maven 3.0 the designers decided that even fetching newest version of plugins is too dangerous.

However, there is hope. Run:

mvn versions:display-dependency-updates

and discover new version manually. Bump them only if you know what you are doing.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674