bnd icon indicating copy to clipboard operation
bnd copied to clipboard

biz.aQute.launcher imports "impossible" packages

Open laeubi opened this issue 9 months ago • 10 comments

If i download this released jar here:

https://mvnrepository.com/artifact/biz.aQute.bnd/biz.aQute.launcher/7.1.0

the manifest contains:

Import-Package           aQute.launcher.agent
                                        aQute.launcher.pre

but these seem to be nowhere exported, instead they are part of an embedded jar named biz.aQute.launcher.pre.jar, leading to problems like:

Missing requirement: biz.aQute.launcher 7.1.0.202411251545 (biz.aQute.launcher 7.1.0.202411251545) requires 'java.package; aQute.launcher.agent 0.0.0' but it could not be found

if one tires to include that in a runtime.

laeubi avatar Feb 19 '25 08:02 laeubi

Also org.osgi.framework [1.8.0,1.9.0) seems problematic as we are now at 1.10 already

laeubi avatar Feb 19 '25 09:02 laeubi

The launcher as bundle?

Ok that it should be fixed but I can't see a use case for the launcher to be a bundle?

pkriens avatar Feb 19 '25 16:02 pkriens

The launcher as bundle?

At least it has Manifest headers that indicate it is a bundle :-)

I can't see a use case for the launcher to be a bundle?

Currently bndtools uses a quite nasty workaround by using https://github.com/bndtools/bnd/tree/master/biz.aQute.bnd.embedded-repo that effectively packs some jar into a bundle and then is extracted at runtime so they are available at runtime and can be shipped with the IDE. This requires a quite "fat" monolith of 6MB that can not be updated independently.

What I instead often do is to install such things as a bundle in the runtime (even though it not actually "executes" anything) and then fetch the bundle location (see for an example here) and then it can be used as a jar (e.g. to fork an independent process) but one can still update it like a regular bundle. The other neat effect is, that by inspecting the wires one can compute a runtime class-path to launch such bundle.

So for that purpose it would even be ok it it just do not import/export anything at all and just has a BSN a Version and Main-Class attribute :-)

laeubi avatar Feb 19 '25 16:02 laeubi

Why not get these constituents from a repo? They are all on Maven Central now?

This was a solution before the repos were as ubiquitous as they are now. Maybe we should get rid of this embedded repo?

pkriens avatar Feb 20 '25 10:02 pkriens

Why not get these constituents from a repo? They are all on Maven Central now?

Yes I try to consume them from central (and Tycho actually already does it), but the problem for bndtools (and pde where I currently try to integrate this) is that in order to put it into an update-site (so P2 can 'install') them is that it fails because P2 think there is a missing requirement (the biz.aQute.launcher 7.1.0.202411251545 (biz.aQute.launcher 7.1.0.202411251545) requires 'java.package; aQute.launcher.agent 0.0.0' but it could not be found), so thats why I opened the ticket here.

laeubi avatar Feb 20 '25 11:02 laeubi

Ok, fixing seems a good idea anyway ... bad metadata is worse than no metadata

pkriens avatar Feb 20 '25 14:02 pkriens

Are you going to provide a PR?

pkriens avatar Mar 14 '25 17:03 pkriens

@laeubi Do you still need this? Can you provide or help with a PR?

chrisrueger avatar Jun 06 '25 15:06 chrisrueger

This is still needed, but it seems more suitable to be solved by someone more familiar with the bnd-magic used here to create the jar.

laeubi avatar Jun 06 '25 16:06 laeubi

@laeubi I can help, but need your input. Let's have a call next week or so.

chrisrueger avatar Jun 06 '25 18:06 chrisrueger