Bundle eclipse.ini with product in deployable feature? - eclipse

I am exporting a deployable feature which bundles a product plugin. Within this product plugin, I have created a customized welcome page and a splashscreen. Now I want that after installation of the exported deployable feature, the eclipse.ini file will be changed in order to pass my own product plugin to the argument -product and -showsplash. Currently, users need to make these changes manually after installation of the feature. Is there a better way, for example to bundle the modified eclipse.ini with the product?

In your feature's build.properties file, you can have it include arbitrary files with a line like this:
root.win32.win32.x86=absolute:file:eclipse.ini
Information on what can be included in the build.properties file can be found here.

Eclipse ini is normally created during build or installation. The content can be given inside the ProductConfiguration Editor - Launching. You can specify your parameters there and they will be entered into your build generated p2 product. When the product is installed the parameter will be added to the eclipse.ini file.

Related

Exporting an Eclipse plugin with a dependency on an external jar

Just recently started using Eclipse and ran into an issue with exporting the plugin I'm working on. I tried to search but so far no luck - but if the answer is already here I'd be grateful if someone can point me to it.
I'm writing a n OSGi/Equinox plugin with Eclipse. The plugin is for a 3rd party system, which allows extensions: basically all jars placed in the application's plugin folder are automatically loaded into the application at startup. I have managed to put together my plugin, it's loading fine and it works.
The issue is that I rely on another plugin which is placed beside mine in the plugins folder. For obvious reasons I do not want to package that plugin into my plugin jar file. I have tried to add the dependency as an external archive, but this breaks the export: when I try to export my plugin project ant complains about missing dependencies and types. (If I actually include the other jar file in my plugin everything works, but obviously this is less then ideal.)
So: how do I set up my plugin project dependency, that it's a) an external dependency and b) doesn't need to be specified with a path or a variable - i.e. how do I tell my exporter to "don't worry, it will be there right beside you"?
Edit: Apparently there's an important detail I didn't mention. The external jar file I depend on is not an OSGi plugin, just a regular jar file with some classes in it. To the 3rd party system it seems all the same (all are under the plugins folder, all are loaded into the application), but for Eclipse the distinction seems important.
If you reference the other plug-in as a dependency in your plug-in's MANIFEST.MF the export should work without errors. The plug-in should be listed in the Require-Bundle list in the MANIFEST.MF.
You can do this in the MANIFEST.MF editor by adding to the 'Required Plug-ins' list on the 'Dependencies' tab of the editor.
Note: When referencing other plug-ins you must always use this method. Do not try adding the plug-in jar to the Java build path or anything like that.
If the jar you want to use is not an Eclipse plug-in you must should include it as part of the plug-in and list the jar in the Bundle-Classpath in the MANIFEST.MF. If you cannot do this you can reference an external jar in the Bundle-Classpath using something like:
Bundle-Classpath: .,external:$LIB_LOCATION$/lib.jar
. is the normal entry in for the plug-in code. external:$LIB_LOCATION$/lib.jar looks for lib.jar in a location defined by the environment variable LIB_LOCATION. This method can be difficult to get right.
In the end the solution to my specific problem was to add the external jar file as an Extra Classpath Entry on the build properties tab (this translated to a "jars.extra.classpath = .jar" entry in the build.properties file). I have also added the jar file to the project itself - after adding the extra class path entry that got changed into an external dependency automatically.
With these two changes I was able to successfully export my plugin, which didn't contain the external jar file, but was able to reference it when loaded into the 3rd party system.

duplicate bundle in eclipse Mars Release (4.5.0)

I use eclipse which version is Mars Release (4.5.0) to develop RCP application . In product definition file, I designated javax.servlet 3.1.0 bundle. But after I export product, I found a file javax.servlet_3.0.0_2011xxxx.jar in product plugins directory. It puzzled me a lot. Then I browse the Eclipse directory structures, and two jars exist in eclipse/plugins directories: javax.servlet_3.0.0_2011xxxx.jar
javax.servlet_3.1.0_2014xxxx.jar
I'm confused why there are two javax.servlet bundles. Even if there are two bundles, I had designate a version 3.1.0, why export wizard copy a wrong jar file?
I have solved this problem.
In product definition editor page, a precise version.
Referenced from the picture above( I cannot upload picture now, sorry.), click Properties... button to enter an precise version 3.1.0.v20140161800. I must enter 3.1.0.v20140161800 instead of 3.1.0, because a bundle jar named javax.servlet_3.1.0.v20140161800.jar located in eclipse/plugins directory.
Then I export the product, all is done.

Eclipse Juno: Unable to read model extension

After exporting the product, when i try to run the application i do not see any view in my application.i got the reason, this is because of error "Unable to read model extension"
Does your product work fine when launched from within the Eclipse IDE? Only the exported product generates the error? Then check if the exported product indeed includes all the required files. For example, does it include the plugin.xml, Application.e4xmi, ...?
When launched from within the IDE, all source code files are available to the running product. When exported, however, only files specifically listed in the build.properties file of each plugin will part of the exported product. If for example the model files (*.e4xmi) are not listed in the build.properties file, your exported product will not be able to load the model.

How to build RCP application based on Product Configuration and Target Platform Definition?

I'm about the setup an automatic (command-line) build for my Eclipse RCP Application.
I have found out the following ways to do it:
Buckminster
Using Maven with the pde-maven-plugin
Headless PDE Build
The problem with all these options is that they require me to create essentially a new representation of the information already contained in my target platform definition. For example in Buckminster, this would be the .rmap file.
In my thinking all the information to build the product should be already there when I have the following:
Plugin project with product configuration file (foo.product)
Target platform definition file (foo.target)
Therefore I would expect there to be a command like the following:
build-rcp-product foo.product foo.target win32
Is there anything like that which I may have missed?
With Buckminster you don't need to replicate the information in your target definition file. You can simply import the target file using the importtargetdefinition command. If all your dependencies defined in the target definition file, then in the rmap you define only from where to materialize your plugins (svn, git, maven, file system etc).
With PDE build, there is a filed request (Bug 266311) and it seems it is still not possible to utilize the target file directly but there are some workarounds suggested in there (which I didn't try, I am using Buckminster).
I use the PDE build and it's pretty simple. It essentially gets what it needs from the MANIFEST.MF file and the build.properties file.
The command to run it is more complicated, as you have to start Eclipse and point it to a few things, but it's very well integrated with the IDE. It does everything by making Ant scripts.
you can try tycho
here's a good start:
Tycho tutorial
Reference card
with tycho, all you need is a POM and you usually will not change this information, which is generated via maven

Eclipse RCP: build product able to load all plugins in plugins directory

I need to configure my eclipse product to load all features/plugins in features/plugins directory. Now my product loads just plugins that are listed in metadata, so if I export some plugin directly from eclipse tool as "deployable plugins" it's loaded in my product, but if I put a plugin jar directly in plugins directory It doesn't appear (the same if I work with features)
I simply make new product configurations, put the feature that contains my application plugin and then exporting product I have this problem.
My eclipse version is 3.6.1
I think the problem is in the launcher configuration but I don't know what I have to change
In theory, your exported RCP application should simply pick up any new features and plugins you add later. However, make sure you put the extra stuff in the dropins folder of your RCP, since this is the expected location for manually installed features since the introduction of p2.
If for some reason it still doesn't work, try launching Eclipse with the -clean command line argument.
According to The Eclipse runtime options page, the -clean argument has the following effect:
[...] any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.
In my experience this can resolve many mysterious cases, where newly added plugins are not loaded by Equinox.