felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: maven-scr-plugin and DS 1.3 annotations not working
Date Tue, 22 Mar 2016 06:45:08 GMT
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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 


 
-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@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