javaeclipseunit-testingeclipse-plugin

How do I export an Eclipse plugin without my unit tests being included?


I have an Eclipse plugin project that employs unit tests. My unit tests are under the source code folder along with my other source, but in its own package. I would normally give the project the "Export... -> Deployable plugin-ins and fragments" treatment to create a plugin jar file. When I do that though, it is trying to compile my unit tests (which fails, even though the JUnit libraries are on my Module path). The resulting jar includes my unit tests. There does not seem to be a way to exclude this source from compilation. Any thoughts?


Solution

  • Well, when I posted the question and mentioned "my unit tests are under the source code folder along with my other source, but in its own package" it got me thinking - maybe I need to move my unit tests? I did just that. Now, my "src" folder and packages are by themselves, and my unit tests have been moved to a "tests" folder. I changed my Java Build Path to include the "src" folder (as it has been all along), and now added the "tests" folder with "Contains test sources" set to "Yes". Looks like this now:

    My new Java Build Path

    All is right with the world now. Plugin exports fine, without unit tests being included.