3

I'm trying to use Ant bndwrap task to wrap non-OSGi jars in a directory. My current Ant configuration for this is:

<target name="wrap-jars" description="Wrap non-OSGi jars">
    <taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${biz.aQute:bnd:jar}"/>
    <bndwrap output="${dist.dir}/app-modules">
        <fileset dir="${dist.dir}/app-modules" includes="*.jar" />
    </bndwrap>
    <move overwrite="true" todir="${dist.dir}/app-modules" >
        <fileset dir="${dist.dir}/app-modules" includes="*.bar" />
        <mapper type="glob" from="*.bar" to="*.jar" />
    </move>
</target>

This works fine, but the problem is that it also wraps existing OSGi jar, which causes problems. For instance, I noticed it changes Bundle-SymbolicName header to some default value. It might be changing something else, which I don't want. I only want it to operate on jars that have no OSGi info at all.

Is there some way to tell BND to ignore existing OSGi headers in manifest, or complete jars that are already OSGi-fied?

vdjurovic
  • 178
  • 2
  • 13

3 Answers3

0

I've noticed that recent bnd versions (for example, 2.1.0) now honour the Bundle-SymbolicName when rewrapping OSGi jars.

Holly Cummins
  • 10,767
  • 3
  • 23
  • 25
0

I would store non-OSGi jars in a separate folder and modify the fileset to process only that folder.

palacsint
  • 28,416
  • 10
  • 82
  • 109
  • Hm, that's an idea, but it would complicate things on another front. In my project, packaging is done automatically, and I have no way of distinguishing whethet jars are OSGi compliant or not. I was thinking of using BND definitions file for it, but I have no idea how to do it. – vdjurovic Nov 17 '11 at 16:41
  • Maybe you can modify the bnd's source and use a custom bnd fork. Ant tasks usually not too complicated. – palacsint Nov 17 '11 at 17:04
  • I actually invoke this task from Maven, so I would rather use stock BND. But, I might be able to figure out something from task source code. – vdjurovic Nov 18 '11 at 14:31
-1

just change your fileset to exclude that jar

user63233
  • 1
  • 1
  • 2
    Hi! Welcome to Stack Overflow. This answer is a little sparse -- could you elaborate further with perhaps an example or an explanation of how this answers OP's question? Thanks! – Anthony Neace Aug 12 '13 at 21:36