为什么反射不想加载我的测试 类?

Why reflections doesn't want to load my test classes?

我在 Java 中使用反射:

<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>

我可以加载每个 classes 除了我的测试 classes。

List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());

Reflections reflections = new Reflections(new ConfigurationBuilder()
    .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
    .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))));

我正在使用这个方法:

Set<Class<?>> allClasses = reflections.getSubTypesOf(Object.class);

我的测试 class 与其他 class 位于同一位置(在 src/main/java 中)

我觉得是框架的问题。 我认为 Reflections 找不到 JUnit,因此无法加载 class。 我可以提供 classReflections 的路径吗??

不在目标中? => 没有看到倒影...