2017-03-07 56 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 - 請參閱更新回答 –