Problems building Eclipse RCP application - eclipse-rcp

I'm trying to build a Eclipse RCP application with Maven/Tycho based on features. My application is a simple language with an editor (built within help of Xtext) and a few other plugins which are dependencies to the project. There are a few howtos which describe how to create a Eclipse RCP application, e.g.
http://mattiasholmqvist.se/2010/03/building-with-tycho-part-2-rcp-applications/
or
https://kthoms.wordpress.com/2010/11/12/setting-up-a-rcp-product-for-a-dsl/
So far, what have I done:
Created a plug-in project which contains a feature.xml. The feature.xml consists of the language plug-ins and its dependencies
Created a plug-in project which contains a product definition. The product definition is named after the plug-in projects name (Mattias Homlqvist (first link in this post) emphasizes that Tycho makes assumptions about the product file name (in relation to the plug-in project name)). In the product definition I've created a new product and point to the 'org.eclipse.ui.ide.workbench' application. I've also added my feature plug-in and org.eclipse.pde and org.eclipse.rcp features to the dependencies tab in the editor.
If I'm trying to run the product I get an exception:
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.
startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.
run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.
runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.
start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.
invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Okay, something went terribly wrong. Now, I'm checking if all required plugins are added in the run configuration dialogue in the "Plug-ins" tab. So, the product and feature plugin are not selected. If I press 'add required plug-ins' the product plug-in is added, pressing 'validate plug-ins' just pop up and says 'no problems detected'. If I try again to run the product I get the same exception. Pressing 'synchronize' in the product definition editor reverts my changes I've made (product and feature are de-selected) - and I'm wondering why?
The Maven/Tycho build itself seem to work. If I'm trying to build the project with
mvn install
zip files for the corresponding platforms are created. Unfortunately the problem still exists and the build is not executable. So, probably I've made a terrible mistake in my feature and/or product plug-in project. Maybe somebody has an idea or could point me into the right direction?
Thanks in advance!

I had a similar problem and for me it worked to check "Add new workspace plug-ins to this launch configuration automatically" in the run configuration, the "Plug-ins" tab.
You might also check the Auto-Start (for me, "default" worked).
Best regards.

your product should be 'feature based' and in your feature, you should add the same plugins you added on your plugin.xml
plus, in the 'included feature' tab, you should add org.eclipse.rcp feature

Related

Eclipse RCP plugin dependencies

I am trying to generate an RCP product from a set of Eclipse plugin. When I am trying to run the Eclipse plugin from my Eclipse.rcp.product plugin, Eclipse is asking me to add all the dependent plugins. I have done that.
However, on adding a new plugin, it starts asking for dependencies (e.g., third party libraries from Eclipse's Orbit repo) of that plugin too. All the dependencies of individual plugins are referenced in those plugins.
Why do I have to add all the references again in the RCP plugin. What is the way around or right way?
The xxx.product file must list every plugin that your RCP is going to use as this list determines what is included in the resulting product.
This is a separate list from the individual plugin dependencies.
The Dependencies tab of the .product file editor has an 'Add Required' button which should add everything that is needed (assuming you have already added all your plugins).
You can also use 'features' rather than 'plugins' for the product file which reduces the number of things that need to be included in the dependencies.

Eclipse RCP: Plugin does not start

I wrote a new plugin for my eclipse rcp application and added the plugin to the dependencies of my product. I also tried to set the auto-start value of the new plugin to true but it does not start. It shows up as resolved but not as started.
Basically the only thing that this plugin does is to add a help file (table of contents) via the extension point org.eclipse.help.toc.
Any idea why the plugin code isn't executed?
Also: the plugin adds its content if I execute it from inside eclipse. The problem occures after I export it.
Just to be clear ... you're not expecting 'code' to run, but when you launch the exported RCP application standalone, the help contents does not appear in the TOC, right?
How did you define your RCP product? As a feature or plug-in based product?
If based on plug-in's, did you define all the necessary plug-in's on the product dependencies tab?
If based on features, did you add the new plug-in to the feature?

JPA Facet cannot be activated in Eclipse

If I try to activate the "JPA Facet" for my Eclipse (Juno) project and point it to a user library containing the JPA libraries (in my case OpenJPA) I get the error:
"The class 'javax.persistence.Entity' is required to be in the selected libraries."
But this class is present there!
"Solution": The JPA libraries were contained in an Eclipse project folder. If I copy it somewhere outside and create another user library with them it works perfectly (although it has exactly the same content as the one before with the libraries located in the Eclipse project!). Seems like an Eclipse bug...
Just create a user library that contains the javax.persistence... JAR in it (It is located in Eclipse/plugins) and add this library at "JPA Implementation"
I'm using Spring Tool Suite (STS). The problem I was facing is that in the default installation the M2E-WTP plugin does not include the Optional component "m2e-wtp - JPA Configurator for WTP".
So I went to Help -> Eclipse Marketplace... and searched "m2e-wtp".
Click on the Installed button and it will become Change. Click on the Change button and select the optional component "m2e-wtp - JPA Configurator for WTP". Apply changes.
This solved for me.

Dependencies of my RCP application are missing on my update site

I am creating an RCP application. I am planning to provide p2 update functionality.
For example there are 4 plugins: A,B,C,D
Plugin A and B represents the core functionality of my RCP application. I have created a feature with name com.myorg.feature.core. In-side the feature.xml, in the plugin tab I have added plugins A & B.
I am adding feature com.myorg.feature.core as a dependecy in the product file of my RCP applicaton. After that I export the RCP application using product file (here product is a feature based product).
Now I have created two more features.
com.myorg.feature.featureC
com.myorg.feature.featureD
As these are optional functionalities to my RCP application, I want user to chose, whether to install them or not. So user will chose the install new software option where this features will be list.
The problem I am facing is, these plugins C & D are using certain 3rd party libraries e.g. BIRT, NATTABLE. So each time, I build featureC or featureD, put it on the update site and I try to install them in my application, they show the dependency failures, like bundle missing: org.eclipse.birt.core
I go back to the feature.xml for featureC -> plugins tab -> add org.eclipse.birt.core and build feature again. But several times my RCP application failed to install with errors bundles missing.
Is there any mechanism where I can determine all the required bundle from start? Is is the right way to launch updates or new install-able units for my RCP application?
#Priank it is better to add all dependencies in plugins tab in feature.xml, this is only one time effort. You can compute required plugins from dependencies tab of feature.xml
To me, the first question should be if you really want to use the Eclipse PDE export wizards for delivering updates.
Instead, you should set up a headless build for your project. If you are familiar with the PDE (and don't happen to hate Maven ;-), Tycho is probably the right choice for you. (Disclaimer: I'm committer on the Tycho project, and may not know all potential alternatives.)
You can easily make Tycho include all the transitive dependencies in a p2 repository: Just set the option includeAllDependencies to true on the tycho-p2-repository-plugin.

Eclipse 3.7 Required Plug-ins

I am currently running Eclipse 3.7 Indigo
My current project is a Plug-in Project
I wanted to try out the product called icePDF in my existing project.
So I downloaded the two required jar files from the binary download.
icepdf-core.jar and icepdf-viewer.jar
So I created a new plug-in project from existing jars. I am added the two jar files and created the plug-in project. I then exported the project and produced a project jar file .
Went back in to my existing project where I want to use the features of icePDF.
Went to dependencies -> Required Plug-ins -> Added my new icePDF plugin.
I am sure that I am missing a key step. Because as soon as I close the icePDF project in Package Explorer. I get a error in my main project.
Error : Missing Required Plug-in
What I don't understand is I have at least 12 other required plug-ins, none of them are open.
Was this the right way to try and add the icePDF jars to my existing project? Was there a way to just incorporate the jars in to the plug-in project without having to create the new project?
EDIT
Looks like icePDF primarily uses Swing. My project is SWT based, I do not want to use Swing in the project. I am looking for something that will view a existing pdf, convert a pdf and print a pdf to local printer.
Any suggestions??
It is normal behavior that Eclipse reports an error when a required plugin is closed, if this plugin is only available through your workspace. I assume that the other required plugins are 'standard' Eclipse plugins, such as EMF; those do not have to be in your workspace, as they are directly installed into your Eclipse platform.
Another way would be to put the original Jars into your plugin project. Just create a folder, e.g. lib/, paste the Jars there, and add them to the plugin project's class path. The latter is a bit tricky, as you have to add them in the Project Properties as well as in the Manifest.ml (in the 'runtime' tab of the plugin.xml-editor, IIRC) and the build.properties file.
Please read about the Eclipse target platform, as you seem not to be aware of that concept.
Generally speaking, there is an Eclipse environment in which you develop your code (which you use), and there is another Eclipse environment, in which your developed plugin runs (i.e. which a user of your plugin uses). That second one is called "target platform" in Eclipse terms. And they can be different, e.g. you develop in Eclipse 4.2, but your plugins shall run in Eclipse 3.7.
If you don't create a target platform yourself, then Eclipse just assumes its current installation to be the target platform (i.e. your development environment). That is why all "normal" plugins can be used as dependencies without them being in the workspace. But your icePdf plugin is not part of the Eclipse installation (and therefore not part of the target platform), which is why it needs to be available in the workspace.
If you define a target platform, you can then simply add those icepdf plugins to it and don't need to have them in the workspace any longer.