maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Lipp <>
Subject Re: Accessing a maven repository programatically (in 2019)
Date Sat, 20 Apr 2019 20:43:55 GMT
On 2019/04/08 11:21:19, Paul Hammant <> wrote:
> There's shades of to what you>
> posting. I, for one, an interested in what your trying to make after
> solved this problem :)>

It's not trivial. There is a tool called "bnd" that supports the
development and deployment of OSGi bundles. The tool works "natively"
with OSGi Repositories
There are various bnd plugins that provide "OSGi repository views" on a
selection of artifacts from one or more maven repositories. In order to
do this, bnd provides its own library for accessing maven repositories,
including classes for parsing and evaluating POMs.

When I started to write my own bnd plugin
I found that bnd's POM evaluation lacks some features. My first idea was
to replace all of bnd's maven library with the "standard" maven library.
This led to my initial question in this list. Sorry to say, but none of
the answers really helped. I dug further through the maven API and the
sources. Much too late I found,
I wish I had found it earlier, would have saved me a lot of "digging".
It is obviously impossible to use the "standard" maven library (or
better "components") without a ridiculous number of (partially
redundant) CDI libraries. (That gave me quite a different perspective on
bnd's sleek implementation.)

Having understood this, I thought about fixing the problems I had
identified with bnd's POM handling. But somehow, it seemed ridiculous to
maintain this non-trivial functionality twice. So what I have ended up
with is this:
. I use the "components" from the maven library and assemble them myself
to avoid pulling in all those CDI libraries. Assembling the components,
I found that eventually the only "repository functionality" required to
evaluate a POM into a "Model" (using the standard maven components) is
an implementation of "ModelResolver". I therefore provide such an
implementation based on bnd's repository (access) classes
Maybe I'll some day try to assemble a "standard" repository access from
the (former) aether components. But actually, this part of bnd's maven
library seems to work flawlessly, so my motivation is quite low. (And I
still don't understand the aether API. It seems to duplicate a lot of
the functionality provided by the org.apache.maven.* classes.)

Is this an X/Y problem? Maybe. The question was "How can I use the maven
libraries for (easily) accessing a maven repository?". Maybe I should
have asked first "Is the collection of maven APIs in the various
libraries intended to support easy access to the content of a maven

 - Michael

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message