2

How I can add the following dependencies to my Plugin project, currently they just don't show up:

  • org.eclipse.jdt.compiler.apt
  • org.eclipse.jdk.compiler.tool

I am able to introduce the source versions of both as dependency. I've tried to play with access rules to no avail.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • The binary plugin does work and ASTView does not seem to be changed lately, so I don't think mentioning that I used the latest Eclipse Juno (4.2) release matters much. – Maarten Bodewes May 21 '13 at 19:25
  • Have you tried looking up how [lombok](http://projectlombok.org/) guys hook into the compiler? – Raystorm May 23 '13 at 22:02
  • @Raystorm no, I haven't, but it seems that lombok doesn't really program a plugin project (run `lombok.jar` doesn't look too promising to me). Thanks for the idea though, I may check some other open source plugins for which the `.project` file is available. – Maarten Bodewes May 23 '13 at 22:06
  • I'm not an Eclipse plugin writer. I just remember coming across that project a while back and that it did use Eclipse's compiler to do some pretty heavy lifting. Good luck. – Raystorm May 23 '13 at 23:04

1 Answers1

3

The org.eclipse.jdt.compiler.apt and org.eclipse.jdt.compiler.tool bundles are actually bundle fragments, which means that you can't use require-bundle on them directly. Instead, you will need to use import=package to get the code from the fragments on your classpath. You just need to know which package code you require is located in.

If you don't want to rely directly on packages you can find out which bundle the fragments are part of and create a dependency for that specific bundle. In this case this proved to be the org.eclipse.jdt.core bundle that contained both fragments.

See the SO question for more information on require-bundle vs. import-package: When should I use Import-Package and when should I use Require-Bundle?

Community
  • 1
  • 1
Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • Thanks for that insight, it certainly gives me something to explore once I get back to my development machine! – Maarten Bodewes May 24 '13 at 19:05
  • OK, so I found the bundle that contains the said fragments. Depending on that solved the issue. I'll probably edit both the question and this answer, and then reward the points. Thanks for the hint, please check if the changes are according to your standards later on... – Maarten Bodewes May 27 '13 at 12:32
  • Could you check if you are alright with the changes in the question and answer? – Maarten Bodewes May 28 '13 at 19:48
  • Yep. Works for me. I also added a link to a relevant SO question. – Andrew Eisenberg May 28 '13 at 19:58