Aurora
Aurora

Reputation: 4414

Editing the ant build.xml file for an OSGi example - not understanding the instruction

I am tackling the monolith of knowledge that is OSGi and have run into a problem where the instructions in an example are insufficient for someone completely unfamiliar with Ant.

I am following an example of taking jEdit and breaking it up into bundles, as described in the sample chapter 6 of OSGi in Action. One of the first steps is to edit the build.xml file, specifically to remove the jar task and replace it with the bnd definition. And then I am told to 'add instructions to tell bnd where to put the generated bundle'. And this is where I get confused, because I have not worked with Ant before, and plan to use Maven beyond this example. I am hoping someone can explain what the example is asking me to do. The text is as follows (on page 209 of ch 6):

First, comment out the jar task:

<!-- jar jarfile="jedit.jar"                 
  manifest="org/gjt/sp/jedit/jedit.manifest" 
  compress="false">
...
</jar -->

The first line above shows where to put the JAR file,
and the second lists fixed manifest entries. Next,
add the bnd definition and target task:

<taskdef resource="aQute/bnd/ant/taskdef.properties"
  classpath="../../../lib/bnd-0.0.384.jar" /> 
<bnd classpath="${build.directory}"           
  files="jedit-mega.bnd" />

Here, you first give the location of the bnd JAR file to tell
Ant where it can find the bnd task definition. Then you specify
a bnd task to create your bundle JAR file, giving it the project
class path and the file containing your bnd instructions....The
first thing you must add is an instruction to tell bnd where to 
put the generated bundle:

-output: jedit.jar

The bnd task can also copy additional manifest headers into the final 
manifest, so let’s ask bnd to include the original jEdit manifest rather 
than duplicate its content in your new file:

-include: org/gjt/sp/jedit/jedit.manifest

Basically, I have no idea what to do with the -output and the -include. My edits so far are as follows:

jEdit build.xml screenshot

Upvotes: 2

Views: 2154

Answers (1)

oers
oers

Reputation: 18704

This here seems to be official doc of your bnd task:

http://www.aqute.biz/Bnd/Ant

output and include seem to be attributes of the task

So it could be:

<bnd classpath="${build.directory}"           
  files="jedit-mega.bnd" 
  output = 'jedit.jar'/>

And from the command line options page it seems that output does the following:

Override the default output name of the bundle or the directory. If the output is a directory, the name will be derived from the bnd file name.

But include is not mentioned anywhere.

It could also be, that these values are meant for the bnd-File itself (seems reasonable): http://www.aqute.biz/Bnd/Format

Upvotes: 2

Related Questions