Eclipse RCP 片段如何构建 library.jar

Eclipse RCP Fragment How to Build library.jar

我有一个插件片段,它为主机插件贡献了一个 jar 文件,紧随 these instructions。它通过创建一个文件 library.jar 来工作,该文件在 build.properties 中指定并与包含要构建的源的目录相关联。

一切都按预期工作,只是我不知道如何在 Eclipse 中创建 library.jar。当我 运行 指向我的片段项目并将其作为模块包含的 Maven 构建时,文件 library.jar 显示在项目目录中。但是在 eclipse 中构建或清理项目不会创建文件。

我希望其他开发人员能够在他们的 Eclipse 工作区中生成 library.jar 而无需 运行 构建 Maven。我真的很惊讶 Maven 构建在插件项目本身中创建 libary.jar,而不仅仅是在构建目标中创建的产品中。应该有一种方法可以让 Eclipse 在没有 运行Maven 构建的情况下执行此操作。

编辑:

build.properties:

bin.includes = META-INF/,\
               library.jar
source.library.jar = src/

MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Custom
Bundle-SymbolicName: org.python.pydev.custom
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.python.pydev;bundle-version="5.1.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-PatchFragment: true
Bundle-ClassPath: library.jar,
 .
Require-Bundle: org.python.pydev.debug;bundle-version="5.5.0",
 org.eclipse.cdt.debug.core;bundle-version="8.0.0",
 org.apache.log4j

Eclipse 将构建 library.jar 而不是将 class 文件放在正常位置,因为 build.properties 文件如下所示:

bin.includes = META-INF/,\
               library.jar
source.library.jar = src/

bin.includes 中的 library.jar 条目替换了正常的 . 条目。

source.library.jar 条目说 src 中的 Java 文件应该直接放在 library.jar.

您 MANIFEST.MF 中的 Bundle-Classpath 条目应该是:

Bundle-ClassPath: library.jar

(所以没有'.'条目)