you should not use the maven-scr-plugin at all in this case - there is a bnd
plugin for the old felix SCR annotations that does the same job.
so use only maven-bundle-plugin and add an instruction
<_plugin>org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir=${project.build.outputDirectory}</plugin>
for a full example see [1]
on the long run you should migrate to the OSGi annotations and remove the felix
scr annotations.
stefan
[1]
https://github.com/wcm-io/wcm-io-tooling/blob/develop/maven/aem-global-parent/pom.xml
>-----Original Message-----
>From: Roy Teeuwen [mailto:[email protected]]
>Sent: Thursday, March 16, 2017 9:03 AM
>To: [email protected]
>Subject: Using OSGi DS and old Apache Felix SCR together
>
>Hey all,
>
>I am running in a problem when trying to use OSGi DS annotations and Apache
>Felix annotations together. I have unit tests that depend on the service
>xml's being present (I am using the Apache Sling osgi-mock to run unit
>tests), but the problem that I am facing is that when the maven-bundle-
>plugin:manifest phase has been executed, the maven-scr-plugin deletes the
>maven-bundle-plugin xml's again created by the maven-bundle manifest phase,
>is there any way to avoid this and make it that they are merged togheter?
>All xmls are present in the JAR file when everything is compiled so in the
>end it works out, but I need them for the unit tests too.
>
>The configuration I am currently using at the moment:
>
><plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>3.2.0</version>
> <configuration>
> <instructions>
> ...
> <_dsannotations>*</_dsannotations>
> <_metatypeannotations>*</_metatypeannotations>
> </instructions>
> <exportScr>true</exportScr>
> </configuration>
> <executions>
> <!--
> Configure extra execution of 'manifest' in process-classes
>phase
> to make sure SCR metadata is generated before unit test runs
> -->
> <execution>
> <id>scr-metadata</id>
> <goals>
> <goal>manifest</goal>
> </goals>
> <configuration>
> <supportIncrementalBuild>true</supportIncrementalBuild>
> </configuration>
> </execution>
> </executions>
></plugin>
><plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-scr-plugin</artifactId>
> <version>1.24.0</version>
> <executions>
> <execution>
> <id>generate-scr-reportDescriptor</id>
> <goals>
> <goal>scr</goal>
> </goals>
> </execution>
> </executions>
></plugin>
>
>Greetings,
>Roy
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]