Discussion:
[m2] path relative to parent/reactor pom.xml
Damian Krzeminski
2006-02-09 15:36:55 UTC
Permalink
What's the recommended way of specifying paths that are always relative to parent pom (regardless if
I am building from parent directory or from any of the subprojects directories)?

All my subprojects are sharing the same checkstyle.xml file. I am trying to configure my checkstyle
plugin in parent pom:

<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>meta/checkstyle.xml</configLocation>
...


but configLocation is always relative to current directory (user.dir)

Is the any way I can configure it without using environment variables or absolute paths?
Damian
Wendy Smoak
2006-02-10 00:48:10 UTC
Permalink
Post by Damian Krzeminski
What's the recommended way of specifying paths that are always relative to parent pom (regardless if
I am building from parent directory or from any of the subprojects directories)?
All my subprojects are sharing the same checkstyle.xml file. I am trying to configure my checkstyle
We use svn:externals for this, to include a directory with common
build information "under" each sub-project. With the additional
'current' external that pulls in the trunk of each sub-project, it
looks like this:

struts/current/action
struts/current/action/build
struts/current/build
struts/current/taglib
struts/current/taglib/build

All three of those 'build' directories are really /struts/build/trunk/
in the svn repo.

That won't really help if you're not using Subversion. :) But I'm
also interested to know if there's a way to do this with just Maven.
It would seem like that file becomes a dependency... maybe it somehow
needs to be in the Maven repository.

--
Wendy
Lee Meador
2006-02-10 17:04:15 UTC
Permalink
I have all my projects as siblings in the file system. My checkstyle xml
file is in the same folder as all those folders which means that its path in
all the POMs (which they inheirit from the parent) is ../chk.xml.

That same folder is the root of the project in svn.

That seems to work.
Post by Damian Krzeminski
Post by Damian Krzeminski
What's the recommended way of specifying paths that are always relative
to parent pom (regardless if
Post by Damian Krzeminski
I am building from parent directory or from any of the subprojects
directories)?
Post by Damian Krzeminski
All my subprojects are sharing the same checkstyle.xml file. I am trying
to configure my checkstyle
We use svn:externals for this, to include a directory with common
build information "under" each sub-project. With the additional
'current' external that pulls in the trunk of each sub-project, it
struts/current/action
struts/current/action/build
struts/current/build
struts/current/taglib
struts/current/taglib/build
All three of those 'build' directories are really /struts/build/trunk/
in the svn repo.
That won't really help if you're not using Subversion. :) But I'm
also interested to know if there's a way to do this with just Maven.
It would seem like that file becomes a dependency... maybe it somehow
needs to be in the Maven repository.
--
Wendy
---------------------------------------------------------------------
--
-- Lee Meador
Sent from gmail. My real email address is ***@leemeador.com
Damian Krzeminski
2006-02-11 13:51:37 UTC
Permalink
Post by Lee Meador
I have all my projects as siblings in the file system. My checkstyle xml
file is in the same folder as all those folders which means that its path in
all the POMs (which they inheirit from the parent) is ../chk.xml.
That same folder is the root of the project in svn.
That seems to work.
I tried this, but it only worked when I was starting build from one of
the subproject repositories, but not when I was doing that from parent
directory.

For now I ended up defining environment variable that specifies my
parent pom location and referencing it as maven property.
Post by Lee Meador
Post by Damian Krzeminski
Post by Damian Krzeminski
What's the recommended way of specifying paths that are always relative
to parent pom (regardless if
Post by Damian Krzeminski
I am building from parent directory or from any of the subprojects
directories)?
Post by Damian Krzeminski
All my subprojects are sharing the same checkstyle.xml file. I am trying
to configure my checkstyle
We use svn:externals for this, to include a directory with common
build information "under" each sub-project. With the additional
'current' external that pulls in the trunk of each sub-project, it
struts/current/action
struts/current/action/build
struts/current/build
struts/current/taglib
struts/current/taglib/build
All three of those 'build' directories are really /struts/build/trunk/
in the svn repo.
That won't really help if you're not using Subversion. :) But I'm
also interested to know if there's a way to do this with just Maven.
It would seem like that file becomes a dependency... maybe it somehow
needs to be in the Maven repository.
Thanks. We do use subversion but I am not a big fan of svn:externals -
mostly because of problems when branching.

I really like your suggestion of making this somehow into a project
repository. If someone ever figures out how to do that please share it
on the list.
Post by Lee Meador
Post by Damian Krzeminski
--
Wendy
---------------------------------------------------------------------
--
-- Lee Meador
Daniel Kulp
2006-02-11 14:18:43 UTC
Permalink
Post by Damian Krzeminski
What's the recommended way of specifying paths that are always relative
to parent pom (regardless if I am building from parent directory or
from any of the subprojects directories)?
The only way we got this to work is to use properties to define the
location of the parent pom.

The parent pom has something like:
<properties>
<topDirectoryLocation>.</topDirectoryLocation>
<properties>

All the children poms have:
<properties>
<topDirectoryLocation>..</topDirectoryLocation>
</properties>

The path then becomes:
<configLocation>${basedir}/${topDirectoryLocation}/checkstyle.xml</configLocation>


Not "elegant", but it seems to work OK.

I DON'T think it will work with continuum. If you don't use continuum
(we ditched it for Cruisecontrol), you should be OK.

Enjoy!
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
***@iona.com
Loading...