buildr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ittay Dror <>
Subject Re: OSGi support round two
Date Wed, 25 Jun 2008 09:46:02 GMT

Assaf Arkin wrote:
> I circulated a proposal on buildr-dev to make transitive dependencies and
> version matching the focal point for Buildr 1.4.  Briefly it will allow
> you
> to do something like this:
>   compile.with foo
> Which will download, install and compile with foo, but also all of foo's
> dependencies.  Or if foo is another project, bring all of that project's
> dependencies with it.  It will help keep buildfiles smaller by only
> specifying the top packages it's using, and let Buildr figure out the
> rest.
For Java, I don't think this is a good choice (or, at least not good if this
is done the maven way). Say foo uses log4j. Naturally it needs this to
compile. But the project that uses foo doesn't. First thing is that log4j is
downloaded for no reason. It is also added to the javac classpath, but not
much harm here. Now, the project using foo starts using log4j. It compiles
just fine until the foo project decides to change the logging mechanism it
uses. Now the project using it is broken. Also, this can cause jar hell - if
my project uses one version of log4j and foo uses another (or my project
uses foo and bar and they each use a different version of log4j). The best
is to separate dependencies so that foo defines dependencies for it to
compile and a subset of those for clients of it to compile. I think the OSGi
way will have the same problems. Why not, use Ivy (programmatically of


Assaf Arkin wrote:
> Version matching means that foo can specify the package name but no
> version
> number, and Buildr will attempt to match the most recent version for that
> package.  Or you can specify some constraints, like >= 1.2 or != 1.3.
> Right now we provide support for using and publishing packages, and it's
> loosely based on the Maven 2 repository model.  We got the basics working,
> just no support for transitive dependencies (other than an experimental
> transitive method) and version matching.  To that we can also add OSGi
> support, which means putting OSGi meta-data inside the packages (in
> MANIFEST.MF) and reading it from them, in addition or instead of POM
> (depending on source and target).
> The problem is, doing both Maven and OSGi, and transitive dependencies and
> version matching.  They don't like to co-exist, because OSGi and Maven
> handle dependencies and version numbers differently.  Without going into
> too
> much details, I'll illustrate with a simple example.
> Let's say you have three versions of the same JAR: 1.2.0-RC2, 1.2.0-2 and
> 1.2.0-10.  The way Maven works, if the dependency just specifies "1.2",
> then
> the most recent version is 1.2.0-10 because 10 is higher than 2 and
> numbers
> are higher than alphanumeric.
> The way OSGi (and most other packaging mechanisms) work, the last part of
> the version number (qualifier) is just a string.  Being a string, the most
> recent version is RC2, next is 2, and 10 is the oldest.  Developers who
> use
> OSGi never run into this problem because they package everything using
> versions like 1.2.0, 1.2.0-B45 or 1.2.0-R20080506.
> If we pick one model and support it natively, it will get all the cool
> features and we'll do best effort on the other model.  Say we pick OSGi,
> then we'll have a local repository that looks like an OSGi repository,
> we'll
> use OSGi version numbers, and make Maven artifacts look like OSGi bundles.
>  In reverse, if we go with Maven, we keep the same local repository model,
> etc
> Some things I'm not sure we can even do, e.g. Maven snapshots mess with
> OSGi, not sure we can support them if we do both, but OSGi has timestamped
> version numbers that achieve the same thing.
> So part two is which one of these two models we do natively for transitive
> dependencies and version matching, and which one we fake to work like the
> other?
> Assaf

View this message in context:
Sent from the Buildr - Dev mailing list archive at

View raw message