use of uk.gov.justice.raml.maven.lintchecker.LintCheckPluginException in project microservice_framework by CJSCommonPlatform.
the class HandlerScanner method getHandlesActions.
public Collection<String> getHandlesActions(final MavenProject project) throws LintCheckPluginException {
final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
final Set<URL> urls = new HashSet<>();
for (String element : project.getRuntimeClasspathElements()) {
urls.add(new File(element).toURI().toURL());
}
final ClassLoader contextClassLoader = URLClassLoader.newInstance(urls.toArray(new URL[0]), originalClassLoader);
Thread.currentThread().setContextClassLoader(contextClassLoader);
} catch (DependencyResolutionRequiredException | MalformedURLException e) {
throw new LintCheckPluginException("Could not set up class loader", e);
}
final List<String> actions = scanForActions(configureReflections());
Thread.currentThread().setContextClassLoader(originalClassLoader);
return actions;
}
Aggregations