I have a file model.xml
i want to add to my eclipse plugin to read at runtime.
I tried adding it to the manifest.mf
binary build
and source build
and adding it to the build.properties
bin.includes
but when I look in the bin
folder there are only .class
files.
Surely plugins can contain resources and not just .class
files right?
CodePudding user response:
You just list the file in the bin.includes
in the build.properties
- you should be able to do that in plugin.xml/MANIFEST.MF/build.properties editor.
For example in one of my plugins the build.properties
is:
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml,\
fragment.e4xmi
source.. = src/
Which includes a plugin.xml
and a fragment.e4xmi
file.
Note: These are not copied to the bin
directory in your project. When you test your plugin they will be accessed directly in the project. When you build/export your plug-in they will be included in the plugin jar.
You use the FileLocator
API to access these files - that understands where to look.
For example, to access the fragment.e4xmi
shown above:
Bundle bundle = FrameworkUtil.getBundle(getClass());
// or some other way to get the current bundle
URL url = FileLocator.find(bundle, new Path("fragment.e4xmi"));