If you need to get the version at runtime, there will be no instance of RequestContext. Therefore, you can use the package implementation:
Package.getPackage("org.primefaces").getImplementationVersion()
If the package cannot be resolved, you can try to resolve the version through the PrimeFaces class:
PrimeFaces.class.getPackage().getImplementationVersion()
source share