12233

AEM 6.3, maven-bundle-plugin automate OSGi SCR metadata for OSGi annotated classes

Question:

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: <a href="http://felix.apache.org/documentation/faqs/apache-felix-bundle-plugin-faq.html#use-scr-metadata-generated-by-bnd-in-unit-tests" rel="nofollow">http://felix.apache.org/documentation/faqs/apache-felix-bundle-plugin-faq.html#use-scr-metadata-generated-by-bnd-in-unit-tests</a> --> Use SCR metadata generated by BND in Unit Tests.

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?

Will this configuration still work for tests that are written for classes using the older felix src annotations?

Answer1:

I forgot <exportScr>true</exportScr> in the maven config. Now I only have to run my test later in the lifecyle as explained here: <a href="https://github.com/Adobe-Marketing-Cloud/aem-project-archetype/blob/8aecf81ea5bb897a7d8dd5f241d5fcd561c36aa6/src/main/archetype/it.launcher/pom.xml" rel="nofollow">https://github.com/Adobe-Marketing-Cloud/aem-project-archetype/blob/8aecf81ea5bb897a7d8dd5f241d5fcd561c36aa6/src/main/archetype/it.launcher/pom.xml</a> and all will be good.

Recommend

  • extract IP from a buffer of bytes
  • Move a seam application to OSGI
  • AMD - Building library example
  • How to capture and parse JSON returned from Google Maps v3 API?
  • String values look the same but don't “.equals()” each other
  • Batch For loop.. wildcards to determine length of searched files?
  • | operator operation in linq?
  • Using third party libraries
  • Defining a method whose return type is the singleton type of an argument of that method
  • Time taken for Hadoop job to execute
  • Error in GGally: Error in unit(tic_pos.c, “mm”) : 'x' and 'units' must have leng
  • Recreate the Oracle DUAL table
  • Initialization section of the package
  • Iterate through permissions on a file in the windows file system in C#
  • How to synchronize two scrollview in Android?
  • Why are “sc.addFile” and “spark-submit --files” not distributing a local file to all workers?
  • Thread synchronization with syncwarp
  • How to add closing tag for canvas in three js rendered Canvas?
  • Converting query results into DataFrame in python
  • VSCode change debug shell to bash on windows
  • Magento site down due to mysql error General error: 1030 Got error -1 from storage engine
  • Git describe fails to return most recent annotated tag
  • Security issues with PHP's Readfile method
  • onBackPressed() not being executed
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Asynchronous UI Testing in Xcode With Swift
  • Illegal mix of collations for operation for date/time comparison
  • Read text file and split every line in MSBuild
  • angularjs unit test when to use $rootScope.$new()
  • SSO with signing and signature validation doesn't work
  • Cassandra Data Model
  • Trying to switch camera back to front but getting exception
  • Importing jscolor library in angular 2
  • Delete MySQLi record without showing the id in the URL
  • File not found error Google Drive API
  • Programmatically clearing map cache
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?