felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david.a.jen...@gmail.com>
Subject Re: Using OSGi DS and old Apache Felix SCR together
Date Thu, 16 Mar 2017 16:32:50 GMT
I think the bnd support is for the proprietary bnd annotations, not the proprietary felix annotations.
AFAIR bnd never supported the proprietary felix scr annotations.

I also think that bnd (and thus the maven-bundle-plugin) runs and  generates the xml after
the unit tests run, so that you will never be able to  get the xml’s in time for unit tests.
 I don’t know if integration tests (failsafe plugin) run before or after the bundle is assembled,
but I think after, so  perhaps that would be worth looking into.

david jencks


> On Mar 16, 2017, at 2:09 AM, Stefan Seifert <sseifert@pro-vision.de> wrote:
> 
> 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:roy@teeuwen.be]
>> Sent: Thursday, March 16, 2017 9:03 AM
>> To: users@felix.apache.org
>> 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: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message