TomDmitriev / gradle-bundle-plugin

Apache License 2.0
47 stars 24 forks source link

Unit Tests - No OSGi SCR metadata found (missing OSGI-INF in output folder) #76

Open Rpaixao opened 6 years ago

Rpaixao commented 6 years ago

Hello,

I am using your plugin and it works very well when I deploy the generated bundles in my application. However, I'm having problems in unit tests environment.

I am trying to run a unit tests and I'm getting the following Error " No OSGi SCR metadata found for class ..." .

After some research I realized that this error is happening because (unlike in the jar file) there is no OSGI-INF folder with the OSGI SRC Metadata in gradle output folder (see image bellow).

captura de ecra 2017-12-14 as 10 59 58

(I generated the missing folder manually, and the tests run like a charm)

Would you please assist me by understanding this situation?

Thanks!

realPyR3X commented 6 years ago

Hi,

You can resolve this issue by adding the following to your gradle configurations.

// Depend on jar task that runs BND to get OSGi metadata test.dependsOn jar // Add jar to classpath to find OSGi metadata test.classpath += files(jar.archivePath)