Something which might work for you.

parent
 | -- src/main/filters
 | -- pom.xml (pomP)
 | -- module-a
        | -- src/main/resources
        | -- pom.xml (pomA)
 | -- module-b
        | -- src/main/resources
        | -- pom.xml (pomB)

pomP
<filters>

<filter>${relpath-to-parent}\src\main\filters\${env}-filter.properties</filter>
 </filters>
<properties>
  <relpath-to-parent>.</relpath-to-parent>
</properties>

pomA
<properties>
  <relpath-to-parent>..</relpath-to-parent>
</properties>

pomB
<properties>
  <relpath-to-parent>..</relpath-to-parent>
</properties>

This approache could also work for any level depth modules. I use a similar
technique for defining where modules, sub modules, sub-sub modules are
located in the SCM.

project parent pom
<scm>
  <connection>${scm-url}</connection>
  <developerConnection>${scm-url}</developerConnection>
  <tag>HEAD</tag>
</scm>
<properties>
  <scm-username>cruisecontrol</scm-username>
  <scm-host>perforce</scm-host>
  <scm-port>1666</scm-port>
  <scm-baseurl>//depot/project/trunk</scm-baseurl>
  <scm-relurl></scm-relurl>
  <scm-url>scm:perforce:${scm-username}@
${scm-host}:${scm-port}:${scm-baseurl}${scm-relurl}</scm-url>
</properties>

This then means in sub modules you simply define scm-relurl for that
specific project, plus the boiler plate scm details otherwise it doesn't
work:
<scm>
  <connection>${scm-url}</connection>
  <developerConnection>${scm-url}</developerConnection>
  <tag>HEAD</tag>
</scm>
<properties>
  <scm-relurl>sub-project/sub-module</scm-relurl>
</properties>


John

2009/12/15 Anders Hammar <and...@hammar.net>

> One way that springs to mind is to put the filter properties files in a
> separate project, then in each project use the dependency plugin to unpack
> that artifact and then use the properties files.
> However, using filtering in each and every one of your projects with the
> same properties files makes me wondering if there isn't a better option (a
> "nice" way of saying that there might be something wrong in your build
> design :-) ).
>
> /Anders
>
> On Tue, Dec 15, 2009 at 09:44, Michael Ebert <micha.eb...@gmail.com>
> wrote:
>
> > Hi,
> >
> > i'm facing the following issue:
> >
> > I've got a multi module project and resources filtering is activated
> > in every module:
> >
> >    <resources>
> >      <resource>
> >        <directory>src/main/resources</directory>
> >        <filtering>true</filtering>
> >      </resource>
> >    </resources>
> >
> > The directory layout:
> >
> > parent
> >  | -- src/main/filters
> >  | -- pom.xml
> >  | -- module-a
> >         | -- src/main/resources
> >         | -- pom.xml
> >  | -- module-b
> >         | -- src/main/resources
> >         | -- pom.xml
> >
> > My filter files currently reside under src/main/filters in the parent
> > project and are referenced from within the submodules via
> >
> >    <filters>
> >      <filter>..\src\main\filters\${env}-filter.properties</filter>
> >    </filters>
> >
> > So far so good, that works. But I'm getting into troubles when I try
> > to build the modules separately, precise when continuum does so.
> > Continuum checks out the modules in a flat hierarchy and builds the
> > modules --non-recursive (one can get around that but that's not my
> > intention):
> >
> > parent
> >  | -- src/main/filters
> >  | -- pom.xml
> > module-a
> >  | -- src/main/resources
> >  | -- pom.xml
> > module-b
> >  | -- src/main/resources
> >  | -- pom.xml
> >
> > Obviously, the relative referenced
> > ..\src\main\filters\${env}-filter.properties doesn't work any more.
> >
> > Is there any possibility for having my filter files at another common
> > place, that is reachable for every module, regardless of the directory
> > layout? That must be a common problem but I haven't found any solution
> > so far.
> >
> > Thanks,
> > micha.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >
>

Reply via email to