<reference> element not generated when name is missing
------------------------------------------------------
Key: FELIX-2876
URL: https://issues.apache.org/jira/browse/FELIX-2876
Project: Felix
Issue Type: Bug
Components: Maven SCR Plugin
Affects Versions: maven-scr-plugin-1.6.0
Reporter: Felix Meschberger
I have the following class:
@Component(specVersion = "1.1")
@Service(Servlet.class)
@Reference(referenceInterface = LogService.class, strategy =
ReferenceStrategy.LOOKUP)
public class Test extends HttpServlet {
}
Running this through the Maven SCR Plugin, I would expect this descriptor:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<scr:component enabled="true" name="test.Test">
<implementation class="test.Test"/>
<service servicefactory="false">
<provide interface="javax.servlet.Servlet"/>
</service>
<property name="service.pid" value="test.Test"/>
<reference interface="org.osgi.service.log.LogService"
cardinality="1..1" policy="static"/>
</scr:component>
</components>
what I get is the following descriptor without the <reference> element
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<scr:component enabled="true" name="test.Test">
<implementation class="test.Test"/>
<service servicefactory="false">
<provide interface="javax.servlet.Servlet"/>
</service>
<property name="service.pid" value="test.Test"/>
<reference interface="org.osgi.service.log.LogService"
cardinality="1..1" policy="static"/>
</scr:component>
</components>
Adding the "name" attribute to the @Reference tag properly generates
<reference> element, though.
IMHO this is false in multiple ways:
* There is no log message indicating this omission
* According to the DS 1.1 spec, the name attribute is optional; thus a
<reference> element without name must be generated
* If I set specVersion="1.0" in the @Component tag, an error should be
generated for the missing name tag (because the name tag is required in DS 1.0)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira