You could make a system variable PROJECT_ROOT other than that I don't know.

On Dec 13, 2007 11:56 PM, heimlich <[EMAIL PROTECTED]> wrote:

>
> Thanks a lot, Mick. That ought to do the trick. One question though, is
> there
> any way to avoid having a hardcoded path as projectRoot? What I'm looking
> for is some way of defining the top-level pom directory (e.g.
> ${toplevel.project.dir} that points to the directory where I started my
> mvn
> command).
>
> I'm sorry I'm not able to return the favor by helping you out in turn...
>
>
>
>
> Mick Knutson-4 wrote:
> >
> > I have solved that issue by setting a projectRoot variable:
> >
> >         <profile>
> >             <id>local</id>
> >             <activation>
> >                 <activeByDefault/>
> >             </activation>
> >
>  <projectRoot>C:/viewstore/esp_lynx_dap/esp/dap</projectRoot>
> > ....
> >
> > Then my filter is:
> >
> >         <profile>
> >             <id>local</id>
> >             <build>
> >                 <filters>
> >                     <filter>${projectRoot}/src/main/filters/filter-
> > local.properties</filter>
> >                 </filters>
> >             </build>
> >         </profile>
> >
> >         <profile>
> >             <id>dev-7777</id>
> >             <build>
> >                 <filters>
> >                     <filter>${projectRoot}/src/main/filters/filter-
> > dev-7777.properties</filter>
> >                 </filters>
> >             </build>
> >         </profile>
> >
> >
> > Then they all use the same filter.
> >
> > But I have an issue where only the local filter is picked up.
> > Any idea how to override each filter as a profile?
> >
> >
> >
> > On Dec 4, 2007 12:05 PM, CasMeiron <[EMAIL PROTECTED]> wrote:
> >
> >> Yes, i got this problem too this week.
> >>
> >> On Dec 4, 2007 7:40 AM, heimlich <[EMAIL PROTECTED]> wrote:
> >>
> >> >
> >> > Hi all,
> >> >
> >> > I'm in a bit of a pickle, and I'm hoping someone can help me out.
> >> >
> >> > I have an extensive Maven project with the following layout:
> >> >
> >> > project A, packaging: pom
> >> >  project A.A, packaging: pom
> >> >    project A.A.A, packaging: jar
> >> >    project A.A.B, packaging: jar
> >> >    project A.A.C, packaging: war
> >> >    ...
> >> >  project A.B, packaging: pom
> >> >    project A.B.A, packaging: jar
> >> >    project A.B.B, packaging: war
> >> >    project A.B.C, packaging: war
> >> >  ...
> >> >
> >> > And I have a global properties file used as a configuration file that
> I
> >> > want
> >> > filtered depending on which profile I run:
> >> >
> >> > # conf.properties
> >> > URL_TO_SERVER1=${env.server1.address}
> >> > URL_TO_SERVER2=${env.server1.address}
> >> > ...
> >> >
> >> > And I have three filter files:
> >> >
> >> > #dev.properties
> >> > env.server1.address=server1.dev.example.com
> >> > env.server2.address=server2.dev.example.com
> >> >
> >> > #test.properties
> >> > env.server1.address=server1.test.example.com
> >> > env.server2.address=server2.test.example.com
> >> >
> >> > #prod.properties
> >> > env.server1.address=server1.prod.example.com
> >> > env.server2.address=server2.prod.example.com
> >> >
> >> > Now, How do I configure the top POM (project A above) to filter
> >> > conf.properties using (say) filter dev.properties.
> >> >
> >> > I had a go at it with the following top POM:
> >> >
> >> > <project>
> >> >  <modelVersion>4.0.0</modelVersion>
> >> >  <groupId>com.example</groupId>
> >> >  <artifactId>projA</artifactId>
> >> >  <packaging>pom</packaging>
> >> >  <version>1.0-SNAPSHOT</version>
> >> >  <name>Project A</name>
> >> >  <build>
> >> >  </build>
> >> >  <modules>
> >> >    <module>A</module>
> >> >    <module>B</module>
> >> >  </modules>
> >> >  <dependencyManagement>
> >> >     ...
> >> >  </dependencyManagement>
> >> >  <dependencies>
> >> >    <dependency>
> >> >      <groupId>junit</groupId>
> >> >      <artifactId>junit</artifactId>
> >> >      <scope>test</scope>
> >> >    </dependency>
> >> >  </dependencies>
> >> >  <profiles>
> >> >    <profile>
> >> >      <id>dev</id>
> >> >      <activation>
> >> >        <activeByDefault>true</activeByDefault>
> >> >      </activation>
> >> >      <build>
> >> >        <filters>
> >> >          <filter>${basedir}/filters/dev.properties</filter>
> >> >        </filters>
> >> >        <resources>
> >> >          <resource>
> >> >            <directory>src/main/resources</directory>
> >> >            <filtering>true</filtering>
> >> >          </resource>
> >> >        </resources>
> >> >      </build>
> >> >    </profile>
> >> >    <profile>
> >> >      <id>test</id>
> >> >      <build>
> >> >        <filters>
> >> >          <filter>${basedir}/filters/test.properties</filter>
> >> >        </filters>
> >> >        <resources>
> >> >          <resource>
> >> >            <directory>src/main/resources</directory>
> >> >            <filtering>true</filtering>
> >> >          </resource>
> >> >        </resources>
> >> >      </build>
> >> >    </profile>
> >> >    <profile>
> >> >      <id>prod</id>
> >> >      <build>
> >> >        <filters>
> >> >          <filter>${basedir}/filters/prod.properties</filter>
> >> >        </filters>
> >> >        <resources>
> >> >          <resource>
> >> >            <directory>src/main/resources</directory>
> >> >            <filtering>true</filtering>
> >> >          </resource>
> >> >        </resources>
> >> >      </build>
> >> >    </profile>
> >> >  </profiles>
> >> > </project>
> >> >
> >> > The problem is that each subproject tries to refer to the 'filters'
> >> > directory IN ITS OWN directory structure,
> >> > not the one at the top.
> >> >
> >> > The reason for this structure is that I want:
> >> >
> >> > ONE conf.properties
> >> > ONE filter file per profile
> >> >
> >> > and I want the filtered conf.properties copied into
> src/main/resources
> >> of
> >> > each subproject
> >> > (I'm, willing to consider having copies of an unfiltered
> >> conf.propertiesin
> >> > each project's resources directory).
> >> > Can it be done (how?) or should try a different approach (any
> >> > suggestions)?
> >> >
> >> > Or should I have no filtering, and just three different properties
> >> files
> >> > (dev, test and prod)
> >> > at the top and have them included in each concrete project (how do I
> do
> >> > that)?
> >> >
> >> >
> >> > Thanks,
> >> > heimlich
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://www.nabble.com/Profiles-and-filtering---global-files-tf4942371s177.html#a14148383
> >> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> >
> >>
> >>
> >> --
> >> Paulo Cesar Silva Reis
> >> -------------------------------
> >> Powered by GMAIL
> >>
> >
> >
> >
> > --
> > Thanks,
> > Mick Knutson
> >
> > http://www.baselogic.com
> > http://www.blincmagazine.com
> > http://www.djmick.com
> > http://www.myspace.com/mickknutson
> > http://www.myspace.com/BLiNCMagazine
> > http://tahoe.baselogic.com
> > ---
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Profiles-and-filtering---global-files-tp14148383s177p14331471.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---

Reply via email to