How to set up a test project for an Eclipse plugin project

I am working on an eclipse plug-in and I tried to create another test project separately from the plug-in. The reason I'm doing this is to prevent the plug-in from depending on jUnit when it is exported. However, during testing, I cannot access the Eclipse plug-in API. Whenever I try to add plug-in dependencies, the import list is empty.

Does anyone know how to import the Eclipse plug-in API into an existing project? Currently, the layout of the workspace is as follows:

+- com.foo.myplugin
|     |
|     +- JRE System Library
|     |
|     +- Plug-in Dependencies
|     |
|     +- src
|     |
|     +- icons, META-INF, plugin.xml, etc...
|
+- com.foo.myplugin.test
      |
      +- JRE System Library
      |
      +- JUnit 4
      |
      +- src
+5
source share
3 answers

. :

  • com.foo.plugin

  • Java Build Path > Order and Export

  • Plug-in Dependencies

API , .

+3

You can try to add the nature of the plugin to your new project myplugin.test.

In the .project file:

<natures>

        <nature>org.eclipse.pde.PluginNature</nature>
        [...]
</natures>

Then in .classpath add:

<classpath>
        [...]
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        [...]
</classpath>

Remove myplugin.test from the workspace, re-import this project and see if this does the trick ...

0
source

All Articles