JBIDE-13821 based on @maxandersen's patch https://github.com/maxandersen/jbosstools-build/tree/sanetpc but with some tweaks