bnd icon indicating copy to clipboard operation
bnd copied to clipboard

Make the usage of RepositoryPlugin <-> Repository more flexible in bnd (run)s

Open laeubi opened this issue 8 months ago • 5 comments

One thing I noticed quite often now is that when using Bndruns programmatically (not sure if the same problem might occur elsewhere) to perform a resolve operation one sometimes get very strange could not resolve <<INITIAL>>... errors.

After some digging one finds that this is because there are two kind of "repositories":

  1. "bnd" repositories (like FileRepo) that are implemented as RepositoryPlugin and can be used to resolve e.g. bundle classpath and alike
  2. "osgi" repository, that is required to perform a resolve operation (e.g. FileSetRepository) that are usually also RepositoryPlugins

One example is biz.aQute.resolve.BndrunResolveContext.getAllRepos() where it only will get all that are OSGi Repository but this will of course not cover "plain" ones. This is very confusing because the usual bnd operations work, but the resolve suddenly fails.

I could think of two ways to resolve this:

  1. Make bndrun / maybe others "smarter" ...
  2. Have some kind of way to define a "converter" that is when I call aQute.bnd.service.Registry.getPlugins(Repository.class) automatically wraps RepositoryPlugins that do not implement that interface in a Repository thats uses the repository plugin as a backend.

One example is the "implicit" repository CachedFileRepo that come with each Workspace by default, one can use that for all operations in bnd except for resolve... for this purpose one has to explicitly add for example biz.aQute.tester.junit-platform even though it is part of the implict repository.

laeubi avatar Feb 20 '25 14:02 laeubi