[ 
https://issues.apache.org/jira/browse/FELIX-5116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350251#comment-15350251
 ] 

Cristiano Gavião edited comment on FELIX-5116 at 6/27/16 1:32 PM:
------------------------------------------------------------------

I'm trying this with the 3.1.0-Snapshot but it is not working with the manifest 
goal.

The variable bpHeader is always coming as null in my tests:
{code}
    String bpHeader = analyzer.getProperty(Analyzer.SERVICE_COMPONENT);
    Parameters map = Processor.parseHeader(bpHeader, null);
    for (String root : map.keySet())
{code}

could someone explain me the reason for try to get this property from analyzer 
instead to directly get the directory map from the jar (dot) that was built by 
bnd? the same way it is doing for metatypes?
{code}
         // export metatype files from OSGI-INF/metatype
        Map<String,Resource> metatypeDir = 
jar.getDirectories().get(MetaTypeService.METATYPE_DOCUMENTS_LOCATION);
{code}
--- edit
looking in the bndlib, I found two places where components xml are created. 
aQute.bnd.make.component.ServiceComponent.ComponentMaker.createComponentResource(Map<String,
 Map<String, String>>, String, Map<String, String>)(line245), 
{code}
                        // We have a definition, so make an XML resources
                        Resource resource = createComponentResource(name, impl, 
info);
                        String pathSegment = analyzer.validResourcePath(name, 
"Invalid component name");
                        analyzer.getJar().putResource("OSGI-INF/" + pathSegment 
+ ".xml", resource);
                        components.put("OSGI-INF/" + pathSegment + ".xml", 
EMPTY);
{code}
and aQute.bnd.component.DSAnnotations.analyzeJar(Analyzer) Line(83)
{code}
String name = "OSGI-INF/"
                                                                + 
analyzer.validResourcePath(definition.name, "Invalid component name") + ".xml";
                                                names.add(name);
                                                
analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
{code}
Both the xml is being added in the jar directly in the directory "OSGI-INF".

So, I think that this code was used in order to deal with old 
aQute.bnd.make.component.ServiceComponent, that is now deprecated:
{code}
                        analyzer.warning(
                                        "%s annotation used in class %s. Bnd DS 
annotations are deprecated as of Bnd 3.2 and support will be removed in Bnd 
4.0. Please change to use OSGi DS annotations.",
                                        
"aQute.bnd.annotation.component.Component", c);

{code}


was (Author: cvgaviao):
I'm trying this with the 3.1.0-Snapshot but it is not working with the manifest 
goal.

The variable bpHeader is always coming as null in my tests:
{code}
    String bpHeader = analyzer.getProperty(Analyzer.SERVICE_COMPONENT);
    Parameters map = Processor.parseHeader(bpHeader, null);
    for (String root : map.keySet())
{code}

could someone explain me the reason for try to get this property from analyzer 
instead to directly get the directory map from the jar (dot) that was built by 
bnd? the same way it is doing for metatypes?
{code}
         // export metatype files from OSGI-INF/metatype
        Map<String,Resource> metatypeDir = 
jar.getDirectories().get(MetaTypeService.METATYPE_DOCUMENTS_LOCATION);
{code}

> Dump SCR component definitions broken
> -------------------------------------
>
>                 Key: FELIX-5116
>                 URL: https://issues.apache.org/jira/browse/FELIX-5116
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-3.0.0
>            Reporter: Stefan Seifert
>             Fix For: maven-bundle-plugin-3.1.0
>
>         Attachments: FELIX-5116.patch
>
>
> the feature to optionally dump SCR component definitions generated by bnd to 
> the output classes folder introduced in FELIX-3324 is broken ins 
> maven-bundle-plugin 3.0.0 and 3.0.1 - the associated code is never called 
> when generating the bundle or manifest.
> the attached patch fixes this and enabled the behavior for both manifest and 
> bundle goals.
> this feature is imporant for unit test support in IDEs, e.g. for 
> https://sling.apache.org/documentation/development/osgi-mock.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to