Hi.
I don't understand why the scanning is not performed if I store the ClassGraph instance in a variable before calling the scan() method.
For example:
class MyMavenRunner{
companion object {
@JvmStatic
fun main(args: Array<String>) {
val parsedArgs = parseCommandArgs(args)
val classGraph =
ClassGraph()
.verbose()
.enableClassInfo()
.enableMethodInfo()
.disableJarScanning()
.disableNestedJarScanning()
.whitelistPackages(BASE_PACKAGE)
.overrideClasspath(parsedArgs.projectBuildPath.toString())
val data= generateData(classGraph)
print(data)
}
}
}
(where generateData(ClassGraph), declared in another class as static, calls inside classGraph.scan().use {...}) doesn't work (I get 2020-02-04T11:35:35.667+0100 ClassGraph Only returning classpath elements (not performing a scan) from the verbose(), which causes then an NPE when I call getClassesImplementing(MyClass.class.canonicalName)), but if I do
ClassGraph()
.verbose()
.enableClassInfo()
.enableMethodInfo()
.disableJarScanning()
.disableNestedJarScanning()
.whitelistPackages(BASE_PACKAGE)
.overrideClasspath(parsedArgs.projectBuildPath.toString())
.scan()
.use { scanResult -> ... }
inside the generateData directly it works fine.
The main(args) is called from the Maven Exec Plugin.
Hi.
I don't understand why the scanning is not performed if I store the ClassGraph instance in a variable before calling the
scan()method.For example:
(where
generateData(ClassGraph), declared in another class asstatic, calls insideclassGraph.scan().use {...}) doesn't work (I get 2020-02-04T11:35:35.667+0100 ClassGraph Only returning classpath elements (not performing a scan) from theverbose(), which causes then an NPE when I callgetClassesImplementing(MyClass.class.canonicalName)), but if I doinside the
generateDatadirectly it works fine.The
main(args)is called from the Maven Exec Plugin.