It turned out to be a wrong class path due to a transitive dependency from 
felix.scr.bnd. I opened https://issues.apache.org/jira/browse/FELIX-5074 
<https://issues.apache.org/jira/browse/FELIX-5074> about that!
> On 09 Oct 2015, at 18:40, Carsten Ziegeler <[email protected]> wrote:
> 
> Am 09.10.15 um 18:14 schrieb Konrad Windszus:
>> I experimented a bit and using something like this in my pom.xml works 
>> pretty well.
>> 
>> <plugin>
>>  <groupId>org.apache.felix</groupId>
>>  <artifactId>maven-bundle-plugin</artifactId>
>>  <version>3.0.0</version>
>>  <extensions>true</extensions>
>>  <configuration>
>>    <instructions>
>>      <!-- enable processing of default OSGI component annotations (since 
>> OSGi 5) -->
>>      <_dsannotations>*</_dsannotations>
>>      <!-- support inheritance on components -->
>>      <_dsannotations-inherit>true</_dsannotations-inherit>
>>      <!-- enable processing of default OSGI metatype annotations (since OSGi 
>> 6) -->
>>      <_metatypeannotations>*</_metatypeannotations>
>>      <!-- support parsing of maven-scr-plugin annotations through the 
>> felix.scr.bnd plugin -->
>>      
>> <_plugin>org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir=target/classes</_plugin>
>>    </instructions>
>> </configuration>
>> <dependencies>
>>   <!-- 
>> https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd -->
>>   <dependency>
>>      <groupId>org.apache.felix</groupId>
>>      <artifactId>org.apache.felix.scr.bnd</artifactId>
>>      <version>1.4.0</version>
>>    </dependency>
>>  </dependencies>
>> </plugin>
>> 
>> But while migrating from Felix SCR annotations to official OSGi annotations 
>> I just came across another issue: 
>> Bnd in contrast to maven-scr-plugin will not generate bind methods for 
>> fields annotated with @Reference (although @Reference is being allowed in 
>> fields since OSGi DS 1.3). I opened a bug on that at 
>> https://github.com/bndtools/bnd/issues/1148. Maybe someone can comment on 
>> whether that is a bug in Bnd or the DS Plugin in Bnd was never supposed to 
>> modify existing class files (to add the bind method). That is not clear from 
>> the spec (at least to me).
>> This feature would be an important difference to the maven-scr-plugin as 
>> writing those bind methods manually is a lot more verbose…
> 
> This is not a bug, the new DS version directly manipulates the field and
> does not rely an bind methods. The maven.scr.plugin needed to go this
> way to be compatible with the previous DS spec.
> 
> Regards
> Carsten
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> [email protected]

Reply via email to