On 12/12/2007, Arnaud WEBER <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm actually developping a little plugin and i need to access to the
> root directory of my project as a File or as a String.
>
> i've seen there is a Map called pluginContext in the AbstractMojo Class
> and I guess it should be in. Is it inside?


I don't believe so

with which key? isn't there a
> more elegant way to find the project root directory?


the 'project root directory' is a vague concept, as I could check-out a
portion
of a Maven project, and as long as the modules depend on released parent
poms it will still build - in this scenario which is the root: the logical
top-level
parent which doesn't exist in my filesystem, or the top of the fragment that
I checked out?

looking for projects with null parents, using project.getParent() to
traverse
the project hierarchy, or even using getBasedir() and java.io.File to look
for
the top-level pom.xml will provide some answer, but may not be what you
really need...

it's often better to step back and ask: why do I need to know the root
folder?

if it's because you need some resources relative to it, then why not bundle
them up as another jar and use a dependency? - ie. let Maven do the work!

HTH

Thanks
> Arnaud
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Cheers, Stuart

Reply via email to