File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven: last version dependencies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven: last version dependencies" Watch "Maven: last version dependencies" New topic

Maven: last version dependencies

Adrian Cordoba

Joined: Jul 09, 2011
Posts: 18

Hi, all!
I'm newbie in Maven.
How can I make in Maven's POM for my project depends on an artifact's last version?

If I declare:

For this section, I understand JUnit version 3.8 is included in my dependencies. But I want, the last version of JUnit be included.

[Adrián E. Córdoba]
Adrian Cordoba

Joined: Jul 09, 2011
Posts: 18

I got it!
For depend on artifact's last version, use "[version,]", as in the example:

In this way, the project depends on JUnit last version, 3.8 or higher.

Thank you, anyway.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33134

Another option is to use the keyword RELEASE. This means the latest available release. Your approach is better though as it sets constraints.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

There is a price to be paid for such flexibility, however.

In its "normal" mode of working with explicit version numbers, Maven guarantees a consistent result, no matter how long the project has been sitting on the shelf or what versions of modules another person's repository chain includes.

It also guarantees that all of the dependencies have been verified to play well with each other, which can be very important with large and complex projects, where obscure interactions can - and frequently do - cause builds and/or runs to fail. Maven's version of "DLL Hell", if you like.

In other words, with vast power comes vast responsibility, so use this ability with due care.

An IDE is no substitute for an Intelligent Developer.
Adrian Cordoba

Joined: Jul 09, 2011
Posts: 18

Thank you, for your comments.
I agree. Here's the link:
subject: Maven: last version dependencies
It's not a secret anymore!