maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Beland" <dcende...@gmail.com>
Subject Include optional dependencies
Date Mon, 23 Apr 2007 10:53:02 GMT
Hi,


I am presently converting our projects from maven 1.1 to maven 2.
I must say that the transitive dependencies help a lot to reduce the pom and
makes upgrades easier.

But I would like to include optional dependencies as well, without having to
explicitly include them myself in the pom.

For example, I use hibernate 3.2.1.ga, it has an optional dependency on
jgroups-all-2.2.8.
I would like to be able to add an includes statement on the hibernate lib to
tell that I want to include jgroups as well.

The main reason for this, is that I want the same version as specified in
the hibernate pom.
This way, upgrading hibernate would also upgrade my version of jgroups at
the same time.

The only problem I can see though, is how can we set if this dependency
should be optional or not when this artifact is used in another project.
We would have to be able to set optional on the included transitive
dependency.

So I thought it could probably be better if we could set the dependency
explicitly in the pom without specifying the version and have maven resolve
the version from the nearest source (as it does normally) and fail if no
other source of the lib can be found in the resolution tree.
But this would mean more flexibility on the pom and could be hard to
implement.

Otherwise, I know we can use a dependencyManagement on a parent pom.
But if I set this in the parent pom:
    <dependency>
      <groupId>jgroups</groupId>
      <artifactId>jgroups-all</artifactId>
      <version>2.2.8</version>
    </dependency>

and don't set the version in my project, how will maven react when hibernate
upgrades the dependency? Will it use the parent pom version or the hibernate
version as the nearest source?


What are your thoughts on the subject?
Is this something other people would find useful as well?
Am I bothering about something that does not happen often with maven 2 and
should take it as it is?

Thanks for your input,
Daniel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message