我有一個檔案model.xml要添加到我的 eclipse 插件中以在運行時讀取。
我嘗試將它添加到manifest.mf binary build并source build添加到,build.properties bin.includes但是當我查看bin檔案夾時只有.class檔案。
當然插件可以包含資源而不僅僅是.class檔案,對嗎?
uj5u.com熱心網友回復:
bin.includes您只需在中列出檔案build.properties- 您應該可以在 plugin.xml/MANIFEST.MF/build.properties 編輯器中執行此操作。
例如在我的一個插件中build.properties是:
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml,\
fragment.e4xmi
source.. = src/
其中包括一個plugin.xml和一個fragment.e4xmi檔案。
注意:這些不會復制到bin專案中的目錄中。當您測驗您的插件時,它們將直接在專案中訪問。當您構建/匯出插件時,它們將包含在插件 jar 中。
您使用FileLocatorAPI 來訪問這些檔案 - 了解查找位置。
例如,要訪問fragment.e4xmi上面顯示的內容:
Bundle bundle = FrameworkUtil.getBundle(getClass());
// or some other way to get the current bundle
URL url = FileLocator.find(bundle, new Path("fragment.e4xmi"));
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/513623.html
標籤:蚀插件
