maven 2 dependencies

I discovered this neat feature of maven2 that allows a project to specify the minimum version of a dependency but accept any higher version. This allows project writers to not have to hard-coded version dependencies to other projects.

This allows users of those projects to use newer versions of the project’s dependencies automatically. For example, “transparent-politics” depends on “tapestry” which depends on “commons-httpclient”.

If tapestry’s pom.xml specifies its commons-httpclient dependency as:

<dependency>
  <groupId>commons-httpclient</groupid>
  <artifactId>commons-httpclient</artifactId>
  <version>[3.1-alpha1,)</version>
</dependency>


Then when a newer version of commons-httpclient comes out, say 3.1-alpha1, the transparent-politics build will pick that up automatically.

Leave a Reply