It depends on what you want to do with the resource.
I used it with
FileUtils.copyURLToFile( url, new File( outputDirectory, filename ) );
to copy a resource from within the jar file to the target directory.
--
Dennis Lundberg
dan tran wrote:
Dennis, would you suggestion work? since the resource is in a jar,
and therefore obtaining a "File" object is not possible.
am I missing something?
-D
On 7/16/06, Dennis Lundberg <[EMAIL PROTECTED]> wrote:
Sebastien Arbogast wrote:
> In the plugin I'm working on, I have a src/main/resources/foo
> directory and as a result, when the plugin is packaged, I get a foo
> directory at the root of the plugin jar, and that's fine.
>
> But now I want to get a java.io.File reference to this foo directory
> from inside the code of one of my mojos. How can I do that?
>
You can get a URL which can then be used to create a file like this:
URL url = this.getClass().getClassLoader().getResource( "/foo" );
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]