【问题标题】:Editing the ant build.xml file for an OSGi example - not understanding the instruction为 OSGi 示例编辑 ant build.xml 文件 - 不理解指令
【发布时间】: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。到目前为止,我的编辑如下:

【问题讨论】:

    标签: ant osgi


    【解决方案1】:

    这似乎是您的 bnd 任务的官方文档:

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

    输出和包含似乎是任务的属性

    可能是这样的:

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

    从命令行选项页面看来,输出执行以下操作:

    覆盖默认输出名称 捆绑包或目录。如果 输出是一个目录,名称将 从 bnd 文件名派生而来。

    但在任何地方都没有提到包含。

    也可能是,这些值适用于 bnd 文件本身(似乎合理): http://www.aqute.biz/Bnd/Format

    【讨论】:

    • 啊——是的。您对 bnd 文件是正确的。我现在以完全不同的方式阅读本节。出于某种原因,我认为 bnd 文件将是一个生成的输出,而不是我必须自己构建的东西。
    猜你喜欢
    • 2013-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-05
    • 1970-01-01
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多