AEM 6.3,maven-bundle-plugin可以自动为OSGi注释的类提供OSGi SCR元数据 [英] AEM 6.3, maven-bundle-plugin automate OSGi SCR metadata for OSGi annotated classes
问题描述
我正在尝试对OSGI R6注释的类进行单元测试.我发现我必须在maven-bundle-plugin中指定一些信息:
I am trying to unit test my OSGI R6 annotated classes. I found out that I have to specify some info in the maven-bundle-plugin: http://felix.apache.org/documentation/faqs/apache-felix-bundle-plugin-faq.html#use-scr-metadata-generated-by-bnd-in-unit-tests --> Use SCR metadata generated by BND in Unit Tests.
如果我使Intellij中的缓存无效并重新启动并尝试再次执行测试,则它将失败.如果我手动触发Maven-Bundle-plugin的清单目标并运行测试成功,是否可以自动生成元数据?
If I invalidate cache in Intellij and restart and try to execute my test again it fails. If I manually trigger the manifest goal of the maven-bundle-plugin and run the test it succeeds, can I automate the generation of the metadata?
对于使用较旧的felix src注释为类编写的测试,此配置是否仍然有效?
Will this configuration still work for tests that are written for classes using the older felix src annotations?
推荐答案
我在maven配置中忘记了<exportScr>true</exportScr>
.现在,只需要稍后在生命周期中运行测试即可,如下所述:
I forgot <exportScr>true</exportScr>
in the maven config. Now I only have to run my test later in the lifecyle as explained here: https://github.com/Adobe-Marketing-Cloud/aem-project-archetype/blob/8aecf81ea5bb897a7d8dd5f241d5fcd561c36aa6/src/main/archetype/it.launcher/pom.xml and all will be good.
这篇关于AEM 6.3,maven-bundle-plugin可以自动为OSGi注释的类提供OSGi SCR元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!