My first attempt at this was to simply include the Jars as part of my main application. (Eclipse 3.7) I know this is frowned upon, but I'm writing a standalone specialised app and I wasn't too worried about trying to fathom out bundles.
Having attempted to run this:
Reflections r = new Reflections("mypackage");
Set<Class<?>> activeActions = r
.getTypesAnnotatedWith(MyAnnotation.class);
In my stand alone test app this worked fine, but when trying it in RCP I got the following output:
org.reflections.ReflectionsException: could not create Vfs.Dir from url,
no matching UrlType was found [bundleresource://1009.fwk651584550/]
either use fromURL(final URL url, final List<UrlType> urlTypes)
or use the static setDefaultURLTypes(final List<UrlType> urlTypes)
or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
So I looked around for an answer and found This Question which covers my issue but doesn't give me enough detail to solve it. I moved the reflection packages out in to a bundle as a first step, but now when I run it I get no output at all, I don't know if this is because of bad log4j paths or what, but I am now getting no feedback from reflections package.
my activeActions list is empty, so the scanning has not worked (and I didn't expect it to) since I hadn't implemented the second part of the solution, which is to create the custom UrlType. However I have now implemented the custom URL type and still nothing is being found, I don't know why because I can;t see any feedback from the reflections package, it's just not finding anything.
I'mm hoping someone can help me to get Reflections logging working, and then find out why the UrlType solution is not working for me.
EDIT
Here's a joke, If I don't bother with the Bundle and I just shove the reflections jars in to my classpath the scanning works provided the custom UrlType is registered. And the logging all works. Why would I bother with Bundles?