Search code examples
javaeclipseeclipse-plugindependency-management

Dependencies for jdt.compiler cannot be found


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.


Solution

  • 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?