The instructions here applies for the latest Nuxeo version from sources (some instructions like theme reload are new and don't exists in previous version). This will be included un Nuxeo EP 5.4.1.
If your bundle is already installed (you do a reload) you should first uninstall it. For this you need a BundleContext object - which you can get in the bundle activator in start method.
To uninstall the bundle you need the Bundle object that represent your bundle. You can get it from the BundleContext in the OSGi activator or you can iterate over all installed bundles and find the one having your symbolic name (you can use any BundleContext object for the iteration).
To iterate and uninstall (ctx is any bundle context):
Then to install your bundle again you can do this (file is the java.io.File of your bundle):
After uninstalling, installing or reloading a bundle you may want to flush all main Nuxeo caches. This can be done like this:
If you want to reload Nuxeo properties files you should call:
If you want to force the theme reload (if you modify the theme by uninstalling or installing) you should call:
Note that reloading a bundle is working correctly only if the extension point registries where it contribute are correctly handling the contribution removal.
There are some registries that will not work correctly. In that case please report a bug. Anyway document types, actions and other important contributions are working.
Flushing repository cache is important if you make modifications on document types and the JAAS flush is flushing user cache (if you modify logins etc.).