I just generated a new AEM project using archetype 23 and now Adobe uses bnd-maven-plugin instead of the old maven-bundle-plugin.
I am getting an exception org.apache.sling.testing.mock.osgi.NoScrMetadataException: No OSGi SCR metadata found for class java.lang.Class when trying to run tests.
Now, I know how to resolve this one by configuring maven-bundle-plugin as explained here: https://felix.apache.org/documentation/faqs/apache-felix-bundle-plugin-faq.html#use-scr-metadata-generated-by-bnd-in-unit-tests
Is there a similar configuration available for bnd-maven-plugin in order to fix this?
I think this article describes your problem and its solution:
we've published a migration guide from maven-bundle-plugin to bnd-maven-plugin mainly for projects set up with the wcm.io AEM project archetype: https://wcm-io.atlassian.net/wiki/x/BICFSw
however, running AEM Mocks-based unit tests with bnd-maven-plugin should work quite "out of the box" with both the adobe and the wcm.io project archetype. do you encounter your problem on the command line or in a specific IDE?
Thanks @Masoud but that solution is for the old plugin.
@Stefan I encounter this problem both in console (maven build) and IDE (InteliJ). However I found one internal project where this works, so I will compare and let you know the results. It must be either different versions, my mistake or something in the archetype.
Of course Stephan is correct, it works OOTB with BND. I had a mistake in my code on line 3, as registerInjectActivateService does not take class as first argument, but it does take variable number of arguments, so you end up with code that compiles and a misleading exception.
The issue can be closed, not sure if you want to update the API to cover this.
good to hear, closing the ticket