maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dan tran" <dant...@gmail.com>
Subject Re: [M2] Mojo development: access to resources inside the plugin
Date Sun, 16 Jul 2006 18:33:34 GMT
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 <dennisl@apache.org> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message