Hi Matthew,

This question comes back regularly, as I looked for an answer myself...
I came to the conclusion that, according to some posts on this matter,
that Maven's philosophy doesn't encourgae the use of relative paths
connecting modules, as you are never sure that a module will reside on
the same file system than an other, hence the basic dependency
mechanism ;-)

The solution would be to gather all build related resources, like
filter properties files, in a separate project (jar packaging) and set
this artifact as a dependency in the modules that need it.
It should even be declared as an extension, like :

...
  <build>
    <extensions>
      <extension>
        <groupId>my.group.id</groupId>
        <artifactId>build-tools</artifactId>
        <version>1.0-SNAPSHOT</version>
      </extension>
    </extensions>
...

You therefore just need to access the required resources from the classpath.
A question remains to me : how to do so? :-D
By declaring my filter like that ?

...
   <filters>
     <filter>filter-${env}.properties</filter>
   </filters>
...

The <filter> entry doesn't work, I get :

[INFO] Error loading property file
'/path/to/project/folder/filter-myenv.properties'

I've tried with ${classpath}/filter-${env}.properties,
${maven.compile.classpath}/filter-${env}.properties, without
success...

Does anybody has an idea?

Thanks,

Philippe

On 10/5/07, Matthew McCullough <[EMAIL PROTECTED]> wrote:
>
> Here's an additional thread on this exact same problem by someone else.
> Can't find a solution in the thread though:
>
> http://mail-archives.apache.org/mod_mbox/maven-continuum-users/200701.mbox/[EMAIL
>  PROTECTED]
>
>
>
> Matthew McCullough wrote:
> >
> > Maven users,
> >
> > Is there a way to retrieve the super, or super-super pom.xml's ${basedir}
> > such that it consistently returns the "rootmost pom.xml's path"?  It
> > appears that ${basedir} is always the leafmost pom's path when running a
> > multimodule build.
> >
> > So, for example:
> > 1) I have a pom.xml at the root of my tree.
> > 2) I have pom.xmls in subdirectories that reference the parent
> > 3) I have a property that is defined in the root pom.xml that includes
> > ${basedir}
> > 4) Unfortunately, even when running the build via "mvn install" from the
> > root, each leaf pom, as it gets invoked, recalculates the
> > root-pom-defined-property for $(basedir) to be relative to the leaf, not
> > to the original root.
> >
> > Any way to get the root pom.xml's path so that I can do a relative pathing
> > from there?
> >
> > -Matthew McCullough
> > Ambient Ideas
> >
>
> --
> View this message in context: 
> http://www.nabble.com/How-can-I-get-the-path-for-a-root-pom.xml%27s-basedir-in-a-multimodule-project-with-pom-inheritance-tf4577123s177.html#a13065923
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to