How to include an external plugin in my own OSGI Eclipse bundle? - eclipse

I have my own Eclipse platform build by using Tycho.
And i want to include some plugins automatically in it.
So that i can use e.g subclipse without installing it manually.
Whats the possibilities to do this?

You need to add the needed plugins / features to your target platform. Then you can define your packaging to include them by default.

Related

How to add my bnd jars dependencies to my eclipse RCP application?

I have some core plugins created in my workspace that are built with BND tools in eclipse. Now I have to reference those core plugins in my eclipse RCP application which is developed with PDE tool in eclipse. But there is no visibility to the BND generated plugins inside the RCP application. May be I can manually copy those plugins to a folder and add the folder to the target. But I want to get rid of such manual task.
Is there any easy way to add the BND generated plugins as dependencies to my RCP application?
Thanks in advance.
I didn't try with recent version of eclipse and bndtools
But you can try my experiment done 4 year ago
https://github.com/filippor/bndPdeTarget

Eclipse RCP - how do all the jars / bundles interact?

I am developing an Eclipse RCP application and currently my head's a mess. I simply don't understand how the plug-ins and the other normal projects interact with one another, nor do I see how they interact with org.eclipse.* projects either.
So I have the Java Build Path that states which JDK I'm using, and also any external jars I might be needing, and the Target Platform that states on what plug-ins will the RCP application base upon, right?
Now I keep seeing all these required jars:
Plug-In Dependencies
Required bundles in manifest.mf file (listed in Eclipse in the Dependencies tab)
build properties' additional bundles
So where exactly do these jars need to be? In the Target Platform? or in the Build Path?
Does anyone know a good guide to describe this?
Any help / opinions /suggestions are appreciated.
EDIT: I've tried it out, and it seems that when there is a required bundle, it is resolved by adding it to the Target Platform...
The target platform is where you list the complete set of plugins that your RCP depends on, this might be one of the Eclipse downloads or it could be something else entirely.
The Required Plug-ins tab of the manifest.mf lists the plugins that your plugin uses directly. Eclipse will use this to maintain the class path for the plugin and will manage the Java Build Path automatically.
The Plug-in Dependencies list shows your plugin dependencies plus the indirect dependencies.
I have never had to use the additional.bundles in the build.properties so I am not sure why it would be used, none of the plugins in my RCPs use it.
Also on the dependencies tab is Imported Packages. This specifies packages to import without specifying a plugin, see Why do we need `Imported Packages` when we have `Required Plug-ins` in eclipse plugin dependencies?

Want to use both older and newer version of ant plugin in eclipse for two different projects

I want to use two versions of ant plugin in eclipse for two different projects. Both versions are available in the plugins folder of my Eclipse. But I'm able to see only the latest version of ant plug-in when I'm trying to add it in the plug-in dependencies in Manifest.MF file. Please help me with this.
You can try to import both of ant plug-ins into your Eclipse workspace. Then you can let your projects depend on any version of ant for your development.
For building or releasing process, you can use Tycho to define a target platform to include both of them.

Is there a way to develop OSGi bundles without opening or importing the dependent bundles in Eclipse?

When you develop OSGi bundles using eclipse, there are many denpendent bundles to be imported and opened. When there're many bundles, setting up projects is time-comsuming and difficult, especially to newbies .
I've tried the Tycho plugin and m2e; it seems that they are not for this goal.
You can use Eclipse Target Platform concept.
Moreover, with some luck and persistence, you can use remote P2 site as a Target Platform definition in Eclipse. Since you can export Target Platform definition as a file, that means the whole setup for developers will be importing project with that file and selecting this target platform in Eclipse preferences. The Eclipse will download the whole bunch of dependencies itself. For more details see the blog post here.
Also, since you can use that P2 site as a repository for Tycho builds, that allows you to make Tycho use the same set of dependencies as you use in Eclipse making the build more stable. You can host P2 site as a static web content or use repository, like Nexus (however, only commercial version supports P2 repositories, so I have not tried that myself).

Where should Eclipse third-party plugins be stored?

We have an Eclipse RCP product, which means it depends on a number of Eclipse plugins (for the UI etc). We have set up a reference Eclipse ("target") to supply the latter.
Our product also depends on a number of third party plugins. Is there a standard location for these to be put?
We have a few of our third-party plugins in the /plugins of the target Eclipse, but this seems wrong to me. The third party plugins change more frequently than, or at least in a different timeframe to, our reference Eclipse.
I tried putting some third party plugins in a separate project in the workspace (under version control), but the PDE headless build did not seem to find them - even though I used the pluginPath property in the headless build.properties.
This is Eclipse 3.4.2. I am aware than the handling of target platforms has changed somewhat in 3.5.
Most of the comments I've seen see on the web about this seem to assume that you're writing a plugin to be added to a standard Eclipse installation. We're not, it's a completely separate product.
For my RCP applications I created a customized target platform directory for it to use (e.g. rcpapptarget). Under that directory I unzip the following packages:
eclipse-RCP-SDK-3.4.2-win32.zip
eclipse-3.4.2-delta-pack.zip
Then I add what ever other eclipse or third party plug-ins that my application will need. For example:
the latest GEF all .zip file
jay libs EclipseCallBasic_1.1.0 plug-in
derby distributed plug-in
additional eclipse plug-ins needed for help support, cheatsheets, updates etc.
I then setup a workspace for developing that RCP application and point the workspace's "Target Platform" to use that customized target platform directory. I do all my development using that target platform and my headless builds use it too.
To set the target platform choose the Window | Preferences command and then select Plug-in Development | Target Platform from the preference tree. Set the "Location" to point to the directory you created.
There isn't a standard that I know of for where 3rd part plugins should go. You can define an external extension location and store your party plugins/features there. This also allows you to reuse the plugins in multiple Eclipse installs if you wish.
You add an Extension location by going to
Ganymede onwards: Help->Software Updates->Available Software->Add Site->Local
Older versions: Help->Software Updates->Manage Configuration->Add Extension Location
For Ganymede onwards, the extension locations work a bit differently (IIRC the plugins are copied to the standard Eclipse install, which kind of defeats the point),there is however a new concept called dropins that you might find useful.