2017-03-07 59 views
0

我有一个插件片段,它为主机插件贡献了一个jar文件,接下来是these instructions。它的工作原理是创建一个文件library.jar,该文件在build.properties中指定,并与包含要构建的源的目录关联。Eclipse RCP片段如何构建library.jar

这一切都按预期工作,除了我不知道如何导致在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 

回答

0

Eclipse将建立library.jar,而不是把类文件在正常位置时, build.properties文件看起来像:

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

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

source.library.jar项说明src中的Java文件应直接放在library.jar中。

在MANIFEST.MF的Bundle-Classpath条目应为:

Bundle-ClassPath: library.jar 

(所以没有进入 '')

+0

谢谢,但是这正是我在build.properties。 bin.includes条目中有一个警告:插件的类路径库'。'没有相应的源构建条目。那是一条红鲱鱼吗?我的.classpath配置与其他项目相同,在这里没有出现这个警告。这里有不同,因为它是一个片段?我遵循这里的指示(http://blog.ankursharma.org/2009/11/source-and-output.html)无济于事。 – MidnightJava

+0

我也在build.properties中尝试了很多东西,比如“output.library.jar =。”。然后它抱怨:/不是输出文件夹。但我想我是在告诉它做出一个输出文件夹。 – MidnightJava

+0

您可能需要在MANIFEST.MF中正确设置Bundle-Classpath - 请参阅更新回答 –