问题
I have an Eclipse RCP application, and I am trying with no luck to install a plugin I have created that should be deployed separately to the aforementioned application.
To do so, I start the application as ./App -console
, and when it has stopped loading, I type:
install file://URLTOjAR/plugin.jar
It returns me a plugin ID (lets say 288
), so I type afterwards:
start 288
After this, the plugin is working fine, but when I restart the application, by using ss I only can see that the plugin is only "Resolved", but I'd like it to be started.
Is there a way to automate this?
回答1:
The installed and started bundle should be started on the next start.
Maybe the activator throws an exception when the framework tries to start the bundle and it remains in RESOLVED state. Check the logs. Maybe the bundle doesn't handle well the services, resources which are not (yet) available when it's starting.
回答2:
Since you are using an Eclipse RCP app, you are most likely using a SimpleConfigurator to determine your list of currently installed bundles. Open the file App/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
In that file there is a list of installed bundles, their versions and whether or not they should auto-started. You will see a line like this:
ch.qos.logback.classic,0.9.27.v20110224-1110,plugins/ch.qos.logback.classic_0.9.27.v20110224-1110.jar,4,false
The different parts of the line are this:
- the bundle identifier
- bundle version
- jar file name, relative to the install location
- start level (usually just set it to 4)
- whether or not to auto-start your bundle, change this to true.
So, just add a line like this in your bundles.info and you should be good to go.
回答3:
And here's another way to do solve this. A bit messier than using the simple configurator (see my other answer), but it should be more widely applicable.
In the file configuration/config.ini, there should be a property osgi.bundles
. This property takes a comma separated list of bundles to use in the osgi instance. The property looks like this:
osgi.bundles=file:/path/to/bundle,file:/path/to/other/bundle@1\:start
The @1 is the start level of the bundle and :start
means that the bundle should be autostarted.
回答4:
I'm not sure weather i got your question right. But i will give a try:
why are you trying to install bundle/plugin that is not related to the application.If your plugin/bundle has nothing to with the running application environment then just use eclispe environment to launch the bundle with required other plugins.
I think what is happening here is you that bundle get lazy loaded. If the Application plugins does not use the bundle it make sense.
If you really want to make the bundle start with the your application, what you can do is to,
find the configuration file that list all the start info of bundle in your RCP app.
*This can be config.ini file *or the bundles.info file if the application is using simpleconfigurator
insert your bundle information in one of the config files. (theres a parameter to set if you want immediate start - 'true')
HTH, --Pradeep
回答5:
Create another plugin which:
- Listens to bundle lifecycle events (using
BundleListener
). - Records added bundles.
- When started, looks for records from last launch and starts bundles listed there.
来源:https://stackoverflow.com/questions/8012738/add-plugins-with-auto-start-to-eclipse-rcp-application