How to get bundles and jars depended by Eclipse plugin project - java

I am using maven to build my Eclipse RCP applications. I got confused by how to resolve dependencies. I read the documentation of Tycho. It just explain how to build but no much about how to resolve dependencies. How to use maven download bundles to my target platform folder? And how to import ordinary jar packages such as thumbnailator which is not packaged to OSGi bundle? I added dependency in pom.xml, but can not import package in my MANIFEST.MF.

Everything you use in a RCP must be in packaged in a plugin.
You may have to write a simple plug-in to include any jars you have which are not plug-ins.

Related

Add Plugin dependency which is not installed in Eclipse

I am creating an Eclipse plugin for creating a perspective and I need to include a Typescript support for the perspective.
For this, I decided to use the open source project on Github for typescript.java given in this link.
I have packaged the maven project and got the jars and I have placed the jars in the folder called lib in my Eclipse Plug-in project and added the same jars in the classpath of the plugin but still, my project is not detecting the jars and not providing me with the support for Typescript.
I cannot add the Typescript jars to the dependencies section because it is not installed in eclipse so it is not detecting the plug-ins.
This is how my project structure looks like:
Project Structure
This is my build.properties file.
Please help me with this problem.

Glassfish deployed project's dependency libraries

I'm new to Java and dependency management.
I have an EJB jar project with a few maven dependencies. When deploying the project to glassfish I get exceptions, that the classes from those dependencies are not found.
So I've added a maven plugin to copy over the dependencies from the local repository to {glassfish_dir}/glassfish/domains/domain1/lib every build.
I'm also using Netbeans.
Is copying over the the dependencies the proper way to go about this? Is there a better way to make dependencies work with glassfish?
The best way is to make the Maven pom.xml that builds the .war declare a dependency on your EJB jar project. That way your EJB jar and any libraries that it has a dependency on, will be included in the .war file that Maven builds.

Including jars in project path from ivy in Eclipse

I have a java project in eclipse and I'm using ivy dependency manager outside of eclipse, so I have directory structures full of various jar files. Is there a simple way to point my eclipse project's path to the ivy dirs and pick up all the jars?
I'm trying to avoid pulling out each individual jar into my eclipse project directory and hope there's a better way.
There is an ivy plugin for eclipse:
http://ant.apache.org/ivy/ivyde/
A whackier idea is to use groovy to generate the Eclipse .project and .classpath files:
Using Apache Ivy with netbeans

Project Build classes do not include external project imports

I have a project which imports another projects to its build path. When I clean the project to compile classes, the classes imported from external projects are not showing up as part of the compiled classes directory.
Do anyone know how to make sure these external import classes gets compile and included into my build classes?
Thanks
I don't think it's possible. But when you deploy your project, you'll certainly want to create a jar file to hold all your classes. And Eclipse has a wizard to export a jar file and choose to embed dependencies in the jar.
The usual way, however, is to have each project generate its own jar, and to use all the jar of the project + the jars of the dependencies as the classpath of the deployed project.
#Bitmap,
is this a WAR or EAR project?
In EAR project you have to specify clearly the "JAVA EE Module dependency" to include the referenced projects.
If you include a project as a build dependency, it will be for compile-time only.
If these are simple java projects you may want to look at "JAR JAR" enter link description here
to achieve this.
HTH

Runtime issues during developing an Eclipse Plugin

Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have exported it into a jar and have deployed into Eclipse, it not work any more as it couldn't find out the dependent jar. What happened and how to solve the issue? Does anyone know that? please save me.
The MANIFEST.MF has a Tab called "Dependencies" in which alle plugins should placed the current plugin depends on.
At runtime you have to place the "dependencies" plugins in the same folder as the one you want to start or you want to work with.
When a plugin has jars it should use, you have to put the jars to the "Runtime" Classpath Entry and you should add the jar to the "Build" Binary Build entry.
Also, does the plugin.xml associated with your 'external jar' plugin does export the right packages ?
Did you check this article describing all steps necessary to packaging 3rd party jars as plug-ins ?
Other very important points are described in the article PDE and 3rdParty Bundles in OSGI Enterprise apps with rules such as:
Always put dependent JAR Files in separate bundles and describe the dependencies in your Manifest file. Don't hide those JARs in your own bundle.
If possible use Import-Package to resolve your dependencies.
Export only your "public" packages - no internal.
Use Require-Bundle only to resolve dependencies inside your own „universe“, not against common bundles.
Always version Require-Bundle, Import-Package und Export-Package.
Require-Bundle always has a dependency to a bundle with a specific name.
Import-Package isn't dependent from the name of the bundle, so its more flexible. Of course its more work to look at your packages and decide which you need to import or to export compared to a one-liner with Require-Bundle
If a bundle itself contains packages inside the bundle and exports them, never put these packages also into the Manifest as imported packages.
Before deploying of a bundle as plug-in be sure the Package-Uses are re-calculated. Wrong Package-Use entries for exported packages can stop PDE to export your Plug-In.
The working behavior out of Eclipse is normal, since the dependent jar is in the classpath of the project.
Have you had a look at the plugin folder you deployed? I suspect, that the dependency isn't contained in the plugin folder.
I just had a similar problem. I fixed it using the plugin view:
Add jar using the Classpath section of the Runtime tab
Use the Organise Manifest Wizard from the Overview tab to do all the required manifest changes
Use the Export Wizard from the Overview tab to export the finished plugin.
Note I am using Eclipse 3.3 so your milage may vary.

Categories

Resources