I’m not certain how the maven-bundle-plugin is set up, but with bnd by itself 
the default is dsannotatios and metatypeannotations are *, so I’d be surprised 
if you have to specify them in the instructions here.

david jencks

> On Mar 22, 2016, at 12:18 AM, Jens Offenbach <[email protected]> wrote:
> 
> @Carsten 
> This is working... Thank you very much for your help!
> 
> For all those who are on Eclipse PDE and require the OSGI-INF folder in the 
> project root, use the maven-bundle-plugin with 
> "<unpackBundle>true</unpackBundle>" and copy the folder to your project 
> basedir like this:
> <plugin>
>       <groupId>org.apache.maven.plugins</groupId>
>       <artifactId>maven-resources-plugin</artifactId>
>       <executions>
>               <execution>
>                       <id>copy-scr-descriptor</id>
>                       <phase>process-classes</phase>
>                       <goals>
>                               <goal>copy-resources</goal>
>                       </goals>
>                       <configuration>
>                               
> <outputDirectory>${basedir}/OSGI-INF</outputDirectory>
>                               <resources>
>                                       <resource>
>                                               
> <directory>${project.build.outputDirectory}/OSGI-INF</directory>
>                                               <filtering>false</filtering>
>                                       </resource>
>                               </resources>
>                       </configuration>
>               </execution>
>       </executions>
> </plugin>
> 
> Regards,
> Jens
>  
> 
> Gesendet: Dienstag, 22. März 2016 um 07:45 Uhr
> Von: "Carsten Ziegeler" <[email protected]>
> An: [email protected]
> Betreff: Re: maven-scr-plugin and DS 1.3 annotations not working
> The maven-scr-plugin does not support the DS 1.3 annotations.
> Using the maven-bundle-plugin 3.0.1 is all you need. I think you need to
> add this configuration to the bundle plugin:
> 
> <configuration>
> <instructions>
> <_dsannotations>*</_dsannotations>
> <_metatypeannotations>*</_metatypeannotations>
> </instructions>
> </configuration>
> 
> Carsten
> 
> 
> Jens Offenbach wrote
>> Hi,
>> I am using maven-scr-plugin:1.21.0, 
>> org.osgi.service.component.annotations:1.3.0, 
>> org.apache.felix.scr.ds-annotations:1.2.8 and 
>> org.apache.felix.scr.annotations:1.9.12 and maven-bundle-plugin:3.0.1.
>> 
>> This is my annotated class with makes use of the prototype scope:
>> 
>> @Component(immediate = true, configurationPolicy = 
>> ConfigurationPolicy.REQUIRE)
>> @Service(HttpContextMapping)
>> public class HttpContextMappingComponent implements HttpContextMapping {
>> 
>> @Reference(scope = ReferenceScope.PROTOTYPE_REQUIRED, cardinality = 
>> ReferenceCardinality.MANDATORY, bind = "bind", unbind = "unbind")
>> private HttpEndpointManager endpointManager;
>> ...
>> 
>> }
>> 
>> This is the component definition file created by maven-scr-plugin:
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"; 
>> immediate="true" 
>> name="test.osgi.service.http.paxweb.impl.component.HttpContextMappingComponent"
>>  configuration-policy="require" activate="activate" deactivate="dispose">
>> <implementation 
>> class="test.osgi.service.http.paxweb.impl.component.HttpContextMappingComponent"/>
>> <service servicefactory="false">
>> <provide 
>> interface="org.ops4j.pax.web.extender.whiteboard.HttpContextMapping"/>
>> </service>
>> </scr:component>
>> 
>> The prototype scope definition is missing and the plugin has classified the 
>> component as DS 1.1.0 compliant.
>> 
>> Furthermore the build failed with the following error message:
>> [INFO] --- maven-bundle-plugin:3.0.1:bundle (default-bundle) @ 
>> test.osgi.service.http.paxweb ---
>> [ERROR] Bundle test:test.osgi.service.http.paxweb:bundle:1.0.0-SNAPSHOT : 
>> Service-Component entry can not be located in JAR: 
>> OSGI-INF/test.osgi.service.http.paxweb.impl.component.HttpContextMappingComponent.xml~
>> [ERROR] Error(s) found in bundle configuration
>> 
>> With maven-bundle-plugin:2.3.7 the build is working and the component 
>> definition files get added to the jar.
>> 
>> Has anybody an idea what's going on?
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> 
> 
> 
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> [email protected]
> 
> ---------------------------------------------------------------------
> 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]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to