eclipse-pluginosgieclipse-pde

Set bundle start level in Eclipse launch config with features


I'm trying to run a plugin test that requires one bundle to be start with a certain start level. The issue is that this only seems to be possible when using a launch configuration with "plugins selected below only" but not with "features selected below".

I want to avoid maintaining launch configurations based on plugins, which I would need to update every time when a plugin is added or renamed. The process to do so is really cumbersome and creates a lot of conflicts when multiple developers modify the same launch config files.

So instead I want to use launch configurations that are based on features. When selecting "features selected below" I can still add individual plugins but there does not seem to be any option to set start levels though.

I kind of got it working by using the generated config.ini from the product build. Unfortunately it seems to require a bundles.info files which contains a list of individual plugins again, so this doesn't really got me further.

Is there any way to set the start level for certain bundles in this situation, without having to maintain a list of all required plugins for each launch configuration?


Solution

  • Configuration of start levels for feature based launcher is supported in Eclipse 2019-09.
    I didn't test it since I can't update from Eclipse Oxygen yet, but it is exactly what I need.


    For earlier Eclipse versions, I found a possible solution by using the osgi.bundles property to override bundles and their start levels.

    Eclipse has the concept of Configurators which can be used to configure bundle states. A configurator can be set by overriding the osgi.bundles property in the "VM arguments" field of the launch config dialog. I used org.eclipse.equinox.simpleconfigurator to define my required bundles with start levels and autostart properties (I used my product's config.ini as reference for how to set this up). The launcher's VM arguments now look like this:

    -Dosgi.bundles=org.eclipse.equinox.simpleconfigurator@1:start,org.example@2:start
    

    It seems to work but it kind of looks like a hack. I would appreciate if someone knows a better solution.

    The bundle in question was for AspectJ by the way, so my "VM arguments" field looks like this and is AspectJ weaving works correctly now:

    -Dosgi.bundles=org.eclipse.equinox.simpleconfigurator@1:start,org.eclipse.equinox.weaving.aspectj@2:start
    -Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook