【发布时间】:2011-05-04 00:48:13
【问题描述】:
我正在处理 OSGi 这一庞大的知识体系,但遇到了一个问题,即示例中的说明对于完全不熟悉 Ant 的人来说是不够的。
我正在按照 OSGi in Action 的示例第 6 章中描述的将 jEdit 分解为包的示例进行操作。第一步是编辑 build.xml 文件,特别是删除 jar 任务并将其替换为 bnd 定义。然后我被告知'添加指令以告诉 bnd 将生成的包放在哪里'。这就是我感到困惑的地方,因为我以前没有使用过 Ant,并且计划在这个示例之外使用 Maven。 我希望有人能解释这个例子要求我做什么。正文如下(第 6 章第 209 页):
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
基本上,我不知道如何处理 -output 和 -include。到目前为止,我的编辑如下:
【问题讨论】: