I have some integration tests that depend on classes from my main sources. It’s not only about services, but also some utility classes and other internal code.
How can I make these tests work without making all the main classes OSGi exports/imports?
The problem is that the test jar does not include the main classes, so it’s throwing ClassNotFoundException on runtime. It only works when I add export-package on the main JAR and then import-package in test atlassian-plugin.xml. I would really like to avoid that, since exporting all these packages to the container is causing different kinds of trouble.
Somewhat desperate, I’ve tried the following in my pom.xml. None of it seems to do anything:
<testInstructions>
<Include-Resource>
{maven-resources},
@target/my-plugin-1.0.0.jar,
com/acme/common/api/exception/BadRequest.class=target/classes/com/acme/common/api/exception/BadRequest.class,
com/acme/common=target/classes/com/acme/common/**
</Include-Resource>
</testInstructions>