Shading ClassGraph
Shading with maven-shade-plugin
It is important to shade both io.github.classgraph. and nonapi.io.github.classgraph., otherwise you may get a ClassCastException when ClassGraph starts up.
<plugin> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <includes> <include>io.github.classgraph:classgraph</include> </includes> </artifactSet> <relocations> <relocation> <pattern>io.github.classgraph.</pattern> <shadedPattern>some.prefix.shaded.io.github.classgraph.</shadedPattern> </relocation> <relocation> <pattern>nonapi.io.github.classgraph.</pattern> <shadedPattern>some.prefix.shaded.nonapi.io.github.classgraph.</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin>