Scan not performed on saved ClassGraph object
See original GitHub issueHi.
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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
ClassGraph (ClassGraph 4.6.2 API) - javadoc.io
Enables the saving of method info during the scan. This information can be obtained using ClassInfo.getMethodInfo() etc. By default, method info is not...
Read more >io.github.classgraph.ClassGraph.enableClassInfo java code ...
Enables the saving of field info during the scan. This information can be obtained using * {@link ClassInfo#getFieldInfo()}. By default, field info is...
Read more >Scanning Java annotations at runtime - Stack Overflow
I mean that the BeanDefinition object does not provide a way to get the class directly. The closest thing seems to be getBeanClassName...
Read more >ModelSim User's Manual - Microsemi
Menu Item. Description. Breakpoints. Manage breakpoints. Trace. Perform signal trace actions. Dataset Snapshot. Enable periodic saving of simulation data to ...
Read more >io.github.classgraph.ClassGraph Maven / Gradle / Ivy
By default, method info is not scanned. (Automatically calls * {@link #enableClassInfo()}.) * * @return this (for method chaining). */ public ClassGraph ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s this one: https://github.com/classgraph/classgraph/issues/399
Makes sense, I thought you were using it with
it
inuse { ... }
.Please let me know if the fix worked for you (it should do).