Retrieves a resource by name without the caller needing to know where it lives. ResourceManager tries a
set of loaders in turn — the filesystem, the thread context classpath, a jar, a URL — and hands back a
stream or a File.
Useful when a plugin accepts a configuration file that a user might supply as a path, as something on the classpath, or as a URL, and you would rather not write that lookup three times.
Maintained, quietly. The API is small and settled; expect dependency updates rather than new features.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-resources</artifactId>
<version>1.3.1</version>
</dependency>Check the badge above for the current version.
@Inject
ResourceManager resourceManager;
resourceManager.addSearchPath( FileResourceLoader.ID, project.getFile().getParentFile().getAbsolutePath() );
InputStream in = resourceManager.getResourceAsInputStream( "checkstyle.xml" );
File file = resourceManager.getResourceAsFile( "checkstyle.xml" );getResourceAsFile will materialise a temporary file when the resource is not already one, so it works for
classpath and URL resources too.
Java 8 or later.
See CONTRIBUTING.md. In short:
mvn verify builds, and run mvn spotless:apply before pushing or CI will fail on formatting.
Please report security vulnerabilities privately — see SECURITY.md, not a public issue.