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

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?

Related

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

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.

How to use jars in an Eclipse library for eclipse annotation processor?

I want to use the annotation processor that comes with the Ollie library in Eclipse.
Hopefully, the annotation processor is available in the maven repository.
Using Ivy with the Ivyde Eclipse plugin, you can define a separate Eclipse jar library that has only the compiler binaries easily by creating a separate ivy file (named here ivy-compile.xml).
Which is convenient in case the annotation processing tool has many dependencies.
The issue is that Eclipse doesn't let me pick the jar from an Eclipse library. Only from a real folder.
Is there a way to tell eclipse to use the jars in the ivy-compile.xml container?
This thread might help you :
You'll need to add the IVY runtime to the build path of the project. This can be done via Project Properties->Java Build Path under the Libraries tab, select Add Library then select IvyDE Managed Dependencies.
Once that's done, an Ivy resolve will add all the jars specified in ivy.xml to the project's build path.

Source jar files in eclipse

I am using eclipse and having difficulties in finding the related source jar files (including recursive dependencies) manually and linking each one of them to the 3rd party jars in the project class path. I need the source to understand the 3rd party functionality better.
What is the simple way to address this issue?
Your problem is twofold:
First, you have to get (read: download) all the source jar files you need.
Second, you have to tell Eclipse how to find the source jar for a given library.
If you create an Eclipse application (a product or plug-in based on Eclipse Platform or Eclipse RCP) which uses OSGi-Bundles coming from a p2 repository, and if the p2 repository contains the sources, you can usually install the "SDK" feature of the respective project to get the sources.
However, from your question I guess that you are developing a Java application (without OSGi or Eclipse runtime). In this case, I know of no builtin feature of Eclipse which could download and attach the source code for your library jars.
As Phantom Reference said, the best way is to use a tool which is able to download all the referenced jars including their source automatically. And, yes, Maven seems to be the tool of choice, because of its automated dependency management and resolution features.
BTW, if you don't want to use Maven (e.g., because you don't know it and you don't have time to get into it), you could still manually use a Maven repository to find the source (and binary) jars of most common 3rd party libraries there.
Have a look at http://search.maven.org.
I suggest you to move to maven build tool if you are not using it already.
You can configure the maven plug-in in eclipse to do this job for you.
Here are the commands to get the source code as well as the Javadocs by maven itself from command line.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
Here is the screen shot from my eclipse Windows --> Preferences that shows how to configure Maven to download and attach the source as well as Javadocs, all automatically. Hope this helps.

GWT+Eclipse without GWT_CONTAINER

The situation
I'm using GWT with Eclipse and Google Plugin for Eclipse (GPE).
Gradle is the build tool and the Eclipse classpath is generated by Gradle. As I have no "com.google.gwt.eclipse.core.GWT_CONTAINER" on my classpath, GPE always shows the error "The project 'Test' does not have any GWT SDKs on its build path" and the Console sometimes prints "GWT SDK not installed.".
Annother effect is that Eclipse doesn't let me GWT-compile the project (but running dev mode works fine). But that one is ok for me, as I compile using Gradle.
Things I'm aware of
I know that I can exclude all GWT depedencies from the Eclipse classpath and add the container through Gradle (I did that for other projects). But as I can't enforce the GWT version provided by Eclipse (I can only specify the SDK's name in the classpath by adding the suffix "/" to the conatiner), I think thats an ugly solution. Another point is that the GPE update site only lists the latest GWT version available. There's no way to automatically install an older version (yes you can provide one externally).
When using GPE together with Maven and m2e it simply works: GPE links no real SDK for Maven projects but there's a link to the "com.google.gwt" group in the local Maven repository. But that's magic I can't use because:
Gradle's local repository format is different to Maven's
This logic is implemented in the plugin "com.google.gdt.eclipse.maven" and I can't use that without adding a pom.xml to the project
The questions
Is there a possibility to deactivate this nasty error without loosing other GPE features?
Is it possible to do something similar to what GPE+m2e does without
creating my own Eclipse plugin?
Am I right that excluding the jars and adding the container is the only viable solution by now?
You can adapt this library to launch with custom classpath and other settings: https://github.com/eclecticlogic/gwt-launcher

OSGi bundles dependency management in Eclipse

I have an OSGi bundle which is in Eclipse IDE represented as Eclipse Plug-in Project. The only way I found to satisfy the dependencies of this plug-in/bundle is to
1) import all dependencies (.jar files) through File > Import... > Plug-ins and Fragments wizard
2) and then declare the imported dependencies in MANIFEST.MF
Yes, this solution works, but on the other hand after I commit the changes to our repository all my team mates also have to manually import dependencies to Eclipse to fix the compilation errors.
QUESTION:
Is there a solution which does not require such irritating steps? I just want to pull the changes from repository and continue my work without need to fix the dependecies in MANIFEST.MF again and again...
P.S.: To retrieve dependencies we use Apache Ivy.
You need to set up a target platform in Eclipse. I find the easiest way is to put all the dependencies in a folder, and save the target platform as a .target file which I check into source control. Then the only steps my colleagues need to do is retrieve the dependencies and configure Eclipse to use the shared target definition. If we add new dependencies to the definition Eclipse will automatically pick up the changes with a restart or target platform refresh.
The Eclipse documentation should get you started: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/concepts/target.htm
If you develop server based applications then it is much better to let maven or Ivy manage the dependencies and use the maven bundle plugin to generate the Manifest. So you can avoid the Eclipse OSGi mode and the target platform. See http://www.liquid-reality.de/x/DIBZ for a tutorial how to develop OSGi bundles using maven and deploy on Apache Karaf. For Ivy you may have to use a slightly different build but the basics should be the same.