I got two jar files, lets call them domain.jar
and scanner.jar
. In the scanner jar I have used Reflections library like so:
Reflections reflections = new Reflections(new ConfigurationBuilder().addUrls(ClasspathHelper.forPackage(packageName)).setScanners(new SubTypesScanner(false)));
Set<Class<?>> subTypesOf = reflections.getSubTypesOf(Object.class);
where if I point the packageName
to packages inside the scanner.jar everything works fine, but if I try to find classes from the domain.jar
it always returns empty set.
I run it with java -cp domain.jar -jar scanner.jar
Any idea what I'm doing wrong? From Reflections usage examples it supports multimodule projects so this should be possible.