You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Adams <da...@ifactory.com> on 2006/05/03 22:17:04 UTC

[m2] refering to the project root directory

How do you refer to the project root directory in a pom? I have a
configuration setting that I want to set to a path relative to the
project root in a number of sub-modules.

-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] refering to the project root directory

Posted by Wendy Smoak <ws...@gmail.com>.
On 5/3/06, Dan Adams <da...@ifactory.com> wrote:

> How do you refer to the project root directory in a pom? I have a
> configuration setting that I want to set to a path relative to the
> project root in a number of sub-modules.

How do you define the 'project root directory'?  In a multi-module
project with a parent pom structure, the top level pom may come from a
remote repository.

I had trouble with this recently when trying to configure the
CheckStyle plugin to use our custom config file.  The solution I chose
was to build a jar with the config file and use it as an <extension>
in the build.  Then the config file can be located on the classpath.

This is described at the bottom of:
   http://maven.apache.org/plugins/maven-checkstyle-plugin/customize.html

I considered and dismissed the option of using a URL for the path to
the config file.  Even if we kept the config file in svn and versioned
it with the project, we would have to remember to modify the pom after
tagging the repository.  Otherwise you might be in a situation where
you check out an old tag, but the build fails because the config file
has changed.

I'm pretty sure ${basedir} refers to each module, so you would have to
use relative paths to find the parent.  One of the developers who uses
Eclipse had trouble with the relative paths, so we didn't want to do
that.

HTH,
--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: [m2] refering to the project root directory

Posted by "David H. DeWolf" <dd...@apache.org>.
Ahh, well the problem you'll have is that there's not always a base
directory for that. The reason is that the parent does not have to be
installed locally.  

Can that configuration file be pushed into another artifact and included as
a dependency?

David


> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Wednesday, May 03, 2006 4:31 PM
> To: Maven Users List
> Subject: RE: [m2] refering to the project root directory
> 
> Well, it seems that basedir will refer to the directory of 
> the current project/module. I want the path to the top level 
> project from within the the module pom.xmls.
> 
> On Wed, 2006-05-03 at 16:22 -0400, David H. DeWolf wrote:
> > I think ${basedir} is what you're looking for.
> > 
> > David
> > 
> > > -----Original Message-----
> > > From: Dan Adams [mailto:dan@ifactory.com]
> > > Sent: Wednesday, May 03, 2006 4:17 PM
> > > To: Maven users list
> > > Subject: [m2] refering to the project root directory
> > > 
> > > How do you refer to the project root directory in a pom? I have a 
> > > configuration setting that I want to set to a path 
> relative to the 
> > > project root in a number of sub-modules.
> > > 
> > > --
> > > Dan Adams
> > > Software Engineer
> > > Interactive Factory
> > > 617.235.5857
> > > 
> > > 
> > > 
> --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: [m2] refering to the project root directory

Posted by Dan Adams <da...@ifactory.com>.
Well, it seems that basedir will refer to the directory of the current
project/module. I want the path to the top level project from within the
the module pom.xmls.

On Wed, 2006-05-03 at 16:22 -0400, David H. DeWolf wrote:
> I think ${basedir} is what you're looking for.
> 
> David 
> 
> > -----Original Message-----
> > From: Dan Adams [mailto:dan@ifactory.com] 
> > Sent: Wednesday, May 03, 2006 4:17 PM
> > To: Maven users list
> > Subject: [m2] refering to the project root directory
> > 
> > How do you refer to the project root directory in a pom? I 
> > have a configuration setting that I want to set to a path 
> > relative to the project root in a number of sub-modules.
> > 
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> > 617.235.5857
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: [m2] refering to the project root directory

Posted by "David H. DeWolf" <dd...@apache.org>.
I think ${basedir} is what you're looking for.

David 

> -----Original Message-----
> From: Dan Adams [mailto:dan@ifactory.com] 
> Sent: Wednesday, May 03, 2006 4:17 PM
> To: Maven users list
> Subject: [m2] refering to the project root directory
> 
> How do you refer to the project root directory in a pom? I 
> have a configuration setting that I want to set to a path 
> relative to the project root in a number of sub-modules.
> 
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 617.235.5857
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org