views:

422

answers:

4

Is there any way to make maven look for new versions of dependencies?

for example, i have commons-lang commons-lang 2.3

version 2.4 could be out, I dont know. i'd rather not check is manually(by writting 2.4 in this case), because i have many dependencies. I think i saw some trick to make maven use latest version.

A: 

I believe this is only possible with snapshot versions. Someone pleae surprise me !

Btw: When maven downloads dependencies it prints the url to the console. I usually paste this into the browser and just move up a folder to see if there's any new versions available. Saves me from changing pom at random, saves me from knowing where the specific library is located. It's not what you asked for but saves some time anyway...

krosenvold
A: 

Yah you can't make it look for newer versions of dependencies. What you can do is look at the repo, try a search at http://www.mvnrepository.com/

Really you shouldn't want Maven doing this. It could cause a lot of nasty issues. Sometimes backwards compatibility can break even in point releases.

Rob Ottaway
+1  A: 

I think i saw some trick to make maven use latest version.

Yes, there are special version numbers to handle this:

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.

(Excerpt from Maven, the definitive guide)

PS: although the book also mentions this as a "not-so-best" practice...

Olivier
It's better to use the "versions" plugin and upgrade your dependencies in a controlled manner, rather than _always_ having the latest version.
Dominic Mitchell
+1  A: 

mvn versions:display-dependency-updates

Will show dependency updates

Read more here: http://mojo.codehaus.org/versions-maven-plugin/examples/display-dependency-updates.html

Wouter Lievens