@Stefan, is there any way that it is feasible for Intellij IDE to run the sling 
mock unit tests without first doing a compile with maven (and thus triggering 
the bnd-maven-plugin to create the OSG-INF files)? It would be handy if 
SlingContext could compile them "at runtime" of the junit test if they aren't 
available

> On 6 Mar 2023, at 15:09, Stefan Seifert <[email protected]> 
> wrote:
> 
> hello flavio.
> 
> are you getting this error running maven on the command line, or only within 
> your IDE?
> 
> if you are using bnd-maven-plugin, this should work automatically. there are 
> some required configuration options for maven-bundle-plugin [1], but this 
> plugin is outdated and you should migrate [2].
> 
> stefan
> 
> 
> [1] https://wcm-io.atlassian.net/l/cp/vcqy50qF
> [2] https://wcm-io.atlassian.net/l/cp/2tPaJN0X
> 
>> -----Original Message-----
>> From: Flavio <[email protected]>
>> Sent: Monday, March 6, 2023 2:29 PM
>> To: [email protected]
>> Subject: Unable to solve "No OSGi SCR metadata found for class"
>> 
>> Hi Everyone,
>> 
>> I know there are tons of discussions and resources on the Internet, but
>> after many days trying to add the missing suggested dependencies,
>> adjusting the pom.xml with plugins and configurations I have no more ideas
>> on how to solve this.
>> 
>> I would kindly ask your support in order to achieve OSGi framework Unit
>> testing in my project.
>> One of the main suggestions I have found is this one:
>> https://stackoverflow.com/questions/48551036/exception-on-service-
>> activation-in-mock-osgi-context
>> 
>> Still no luck!
>> 
>> Can somebody help me with this please?
>> 
>> Here's the error I get once I try to build via maven:
>> 
>> org.apache.sling.testing.mock.osgi.NoScrMetadataException: No OSGi SCR
>> metadata found for class com.test.ConfigurationService at
>> org.apache.sling.testing.mock.osgi.OsgiServiceUtil.activateDeactivate(Osgi
>> ServiceUtil.java:79)
>> at org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:314)
>> at org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:325)
>> 
>> --
>> Flavio

Reply via email to