Monday, November 22, 2010

How to setup an Eclipse Plugin that can access JDT

In aid of remembering for next time, a few notes on setting up an Eclipse project that can play with the Java model of a project follow.

The first step is figuring out which version of Eclipse to use for plugin development. It was not obvious to me that "Eclipse for RCP and RAP Developers" was what I wanted on the Eclipse download page. After some Googling I puzzled it out but a name that clearly indicated to a noob it was a bundle suitable for Eclipse extension or plugin development would have helped!

Once you have Eclipse for RCP/RAP creating a plugin project is gloriously simple. Just click through some wizard pages:


This gives you a superb little project, all setup for debug and everything! However, said project doesn't have the JDT libraries on classpath so when you try to do anything interesting using the JDT it doesn't compile. You can clearly see that the "Plug-in Dependencies" don't include any of the JDT stuff ... but how to add it?

To add the JDT bits so we can do cruel and unusual things to Java projects double-click on META-INF/MANIFEST.MF in your plugin project, choose the MANIFEST.MF tab at the bottom of the editor, and add the org.eclipse.jdt, org.eclipse.jdt.core to the Require-Bundle block. On save this will add jars to your "Plug-in Dependencies", as shown below:

All easy enough once you know; however as an Eclipse noob this was rather non-obvious. Perhaps next we'll find time to make the JSP property access checker publish to the Eclipse problems view "live".

For using the JDT the documentation is pretty good, as is the JDT_fundamentals.ppt someone put together for eclipsecon 2008 (thus perhaps dated info but still helpful).

3 comments:

Unknown said...

WordPress entered the market in the year 2003 and since then it has become as one of the best open source technologies and the most preferred blogging tool for users all over the world. The ease of use and flexibility that it provides to its users has made it earn world wide applause because of which the Development community is growing like never before. See more elgg plugin development

Anna Schafer said...

In aid of remembering for next time, a few notes on setting up an Eclipse project that can play with the Java model of a project follow. On Eclipse Science blog

Gouse said...

Great guide! The step-by-step instructions on setting up an Eclipse plugin for Scala and accessing JDT are really clear and easy to follow. I appreciate how you explained the integration of Scala within the Eclipse IDE, which can often be tricky for beginners. Looking forward to more Scala tips and tutorials like this!"

Digital Marketing Course In Ameerpet

Post a Comment