问题
I have spent the past few days trying to find a solution to my problem. I am trying to launch an Eclipse RCP using the 3.x compatibility layer using the bndtools launcher via a bndrun file.
I am aware of the solution which involves placing bndtools.runtime.eclipse.applauncher in the list of run bundles in order to get an E4 application to start and that there are ways to migrate an E3.x application to E4. We would like to maintain programmatic control over the Rich Client Platform for the time being so migrating to an XMI file for laying out the Workbench is not ideal at this time.
I created a plug-in project which builds using bndtools. To my knowledge I have included all of the necessary bundles to run the application and have followed several examples (as an aside, most of the OSGI examples I found were console-based).
Because I wasn't seeing the RCP load up (we have an RCP plug-in which extends the IApplication interface and our project structure is still Activator based) I was initially at a loss as to why this wasn't working but adding -osgi-console= to the run properties did provide some additional information:
Using -runfw: org.eclipse.osgi
The final lines are the following:
# framework=org.eclipse.osgi.launch.Equinox@59fa1d9b
# registered launcher with arguments for syncing
# will wait for a registered Runnable
Additionally, the plug-in I am using to test with is marked as STRTD and the bundle that is using it is also marked as STRTD whereas most other bundles are marked as ACTIV, which I assume is also part of the problem. I have tried to force bundles to start by including a line to start several bundles (following other examples) but have run into issues where the console will error stating could not load or find main class for org.eclipse.core.runtime when trying to include that in the list of activated bundles.
Googling (and even Binging) have not appeared to produce a solution which explains how to set up an Eclipse 3.x application to run using a bndrun file. What am I missing? Most recently I tried the following properties:
-runproperties: \
osgi.os=win32,\
osgi.clean=true,\
osgi.console=,\
eclipse.product=org.eclipse.sdk.ide,\
osgi.arch=x86_64,\
osgi.ws=win32,\
equinox.use.ds=true,\
eclipse.application=org.eclipse.ui.ide.workbench
I assume that if the actual test bundle I am using would actually activate that I should also be able to find the application ID set in the plugin.xml file and to use that instead. Trying to activate that plug-in also results in a could not find main class error even though I specify a Bundle-Activator in the bnd file. That Activator does not appear to be started since I have it set to print to the console and nothing is printed. I assume that since the bundle is in the STRTD state that it did not start.
Any help with this would be appreciated.
Edit: As an update, adding org.apache.felix.gogo.runtime and org.apache.felix.gogo.shell did result in my test plug-in's activator getting started. Curiously the plug-in it is dependent on, though, moved from STRTD to RSLVD.
Other discussion has indicated that we might have to manually start an Eclipse instance using EclipseStarter?
回答1:
The following Github repo contains using an example with bndtools and Eclipse 3.8. It uses an adapted bndtools.runtime.eclipse.applauncher inside /cnf/eclipse_common_3.8/bndtools.runtime.eclipse.applaunch-0.1.0.jar see the 3.8 bnd launch config also include here example.aspectj/example.aspectj.bnd.app/run/launch_org.eclipse.osgi_3.8.x.bndrun. This was (beside the Aspect stuff demoed in the repo) the smallest set of bundles to startup an Eclipse app successfully with bnd.
来源:https://stackoverflow.com/questions/44031044/launching-an-eclipse-3-x-rcp-application-using-bndtools