protected void runCustomSetup() throws MojoExecutionException { // Run setup class if (setupClass != null) { ClassLoader cl = createSetupClassLoader(); try { Class<?> setup = cl.loadClass(setupClass); Runnable runnable = (Runnable) setup.getConstructor(String.class).newInstance(moduleName); runnable.run(); } catch (Exception e) { throw new MojoExecutionException("Cannot run custom setup step!", e); } } else { // Reset CommonServices ITypeSystem ts = CommonServices.getTypeSystem(); Registry.initDefaults(); // It has all our shutdown listeners! We need it back! CommonServices.sneakySetTypeSystem(ts); } }