Eclipse plugin fragment dependency

Viewed 134

I have an Eclipse applications with some framents to test the plugin functionality.

Now I need to develop some utility classes, to be used across fragmens, just for the sake of testing.

So I need a plugin (or fragment) to be included ONLY in fragment (is it possible??) to use these utilities.. What's the best way to have such a structure?

(These utilities should not be included in production plugins nor be deployed in production)

Thank you!

1 Answers

You should create a regular plugin for your utility classes and add it as dependency of your test fragments. Using a fragment for utility classes doesn't sound right - what would the host bundle of that fragment be?

These utilities should not be included in production plugins nor be deployed in production

I would assume your test fragments are already excluded from being deployed to production. You should be able to configure everything in a similar way to exclude the utility plugin. How to do that exactly depends on your project setup.


Update for the situation described in the comments:

If some tests from fragments must use a utility plugin which requires dependencies to multiple host plugins, then it means these tests are some kind of integration tests.

Test fragments are useful for unit tests to test internal classes but are not really suitable for integration tests because they easily cause dependencies issues like you have now.

These kind of tests should be moved to their own plugin (I usually have a single integration test plugin for the whole application which also contains test utilities). Then this integration test plugin can depend on everything it requires without conflicts.

Related