Hello! I have understood the root cause of the problem. Adding the following file solved the issue and I was able to run the test flawlessly: src/test/resources/OSGI-INF/serviceComponents.xml
Thanks! Il giorno lun 6 mar 2023 alle ore 15:21 Flavio <[email protected]> ha scritto: > Hi Stefan! > > Thanks for replying. I'm getting this error on the command line. > Consider that I am adding for the first time JUnits to my osgi project so > I have to introduce also this bnd-maven-plugin. > I added the following part to my pom.xml into the plugins section but > still no luck: > > <plugin> > <groupId>biz.aQute.bnd</groupId> > <artifactId>bnd-maven-plugin</artifactId> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-jar-plugin</artifactId> > <configuration> > <archive> > > <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> > </archive> > </configuration> > </plugin> > > > Flavio > > Il giorno lun 6 mar 2023 alle ore 15:09 Stefan Seifert > <[email protected]> ha scritto: > >> 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 >> > > > -- > Flavio > -- Flavio
