Thread.currentThread().setContextClassLoader(loader);
ArrayList<DeploymentModule> modules = new ArrayList<DeploymentModule>();
Iterator<DeploymentModule> discoveredModules = ServiceLoader.load(DeploymentModule.class, loader).iterator();
getProject().log("Loading modules from the specified classpath....");
while (discoveredModules.hasNext()) {
DeploymentModule discoveredModule = (DeploymentModule) discoveredModules.next();
getProject().log("Discovered module " + discoveredModule.getName());
modules.add(discoveredModule);
}
//make sure a basic app module is there.
modules.add(new BasicAppModule());
config = new EnunciateConfiguration(modules);