Search in sources :

Example 1 with PlexusResource

use of org.codehaus.plexus.resource.PlexusResource in project maven-plugins by apache.

the class LicenseResourceManager method getResource.

@Override
public PlexusResource getResource(String name) throws ResourceNotFoundException {
    for (ResourceLoader resourceLoader : resourceLoaders.values()) {
        if (resourceLoader instanceof ThreadContextClasspathResourceLoader && !"config/maven-header.txt".equals(name)) {
            // classloader, only allow config/maven-header.txt
            continue;
        }
        try {
            PlexusResource resource = resourceLoader.getResource(name);
            getLogger().debug("The resource '" + name + "' was found as " + resource.getName() + ".");
            return resource;
        } catch (ResourceNotFoundException e) {
            getLogger().debug("The resource '" + name + "' was not found with resourceLoader " + resourceLoader.getClass().getName() + ".");
        }
    }
    throw new ResourceNotFoundException(name);
}
Also used : ResourceLoader(org.codehaus.plexus.resource.loader.ResourceLoader) ThreadContextClasspathResourceLoader(org.codehaus.plexus.resource.loader.ThreadContextClasspathResourceLoader) ThreadContextClasspathResourceLoader(org.codehaus.plexus.resource.loader.ThreadContextClasspathResourceLoader) ResourceNotFoundException(org.codehaus.plexus.resource.loader.ResourceNotFoundException) PlexusResource(org.codehaus.plexus.resource.PlexusResource)

Aggregations

PlexusResource (org.codehaus.plexus.resource.PlexusResource)1 ResourceLoader (org.codehaus.plexus.resource.loader.ResourceLoader)1 ResourceNotFoundException (org.codehaus.plexus.resource.loader.ResourceNotFoundException)1 ThreadContextClasspathResourceLoader (org.codehaus.plexus.resource.loader.ThreadContextClasspathResourceLoader)1