How to merge two jar's OSGI Service file content

Hello Team,

I have a requirement to create a fat jar .
For Example :
I have A.jar and B.jar. I would like to combine these to C.jar
I am achieving using bnd file by mentioning -buildpath : to include A and B

A.jar has content MATA-INF-services → S
B.jar has content MATA-INF-services → S

In both the jar file ‘S’ is present and content of ‘S’ file is different . When I generate fat jar (C.jar) the file ‘S’ contains only second buildpath included jar .

I would like to have file ‘S’ containing both A and B jar content. How can I achieve this ?
Any help would be appreciated

That is a hard one, but it should be doable via some macro magic:

serviceFileA: @${repo;<BsnOrGAVofA>;<VersionOfA>}!/META-INF/services/
serviceA: ${cat;serviceFileA}

serviceFileB: @${repo;<BsnOrGAVofB>;<VersionOfB>}!/META-INF/services/
serviceB: ${cat;serviceFileA}

content: \
 ' ${serviceA}\
-includeresource: \

I haven’t tested this and I’m not sure if my construct with the new line in the construct would work.

Please not that this will not work for maven, as the repo macros is not supported there.

1 Like

@juergen-albert : Thanks . I will give a try