Hi Janek,

Filtering is obviously the best way to achieve this, but we need to
resolve MNG-791 first.

An alternative way which I'm using in the interim is to use profiles. 
You'll need to create multiple versions of your context.xml and
configure the war plugin accordingly, e.g.:

  src
  |_ profiles
    |_ default
      |_ webapp
        |_ META-INF
          |_ context.xml
    |_ live
      |_ webapp
        |_ META-INF
          |_ context.xml
    |_ ...

Then setup your pom with something like:

  <project>
    ...
    <profiles>
      <profile>
        <id>default</id>
        <activation>
          <activeByDefault>true</activeByDefault>
        </activation>
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <configuration>
                <warSourceDirectory>profiles/default/webapp</warSourceDirectory>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
      <profile>
        <id>live</id>
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <configuration>
                <warSourceDirectory>profiles/live/webapp</warSourceDirectory>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
      ...
    </profiles>
    ...
  </project>

Then just use "mvn -P<profile> war" to build your war with the given
profile's context.xml, e.g. "mvn -Plive war" for the 'live' profile,
or just use the default with a "mvn war"

Mark

On 24/10/05, Claus, Janek (NIH/NICHD) <[EMAIL PROTECTED]> wrote:
> All,
>
> One of the possibilities Tomcat 5.5 suggest for the context configuration of 
> a web
> application is a file named "context.xml" in the META-INF of your webapp.
>
> In my case it declares a datasource, which differs depending on the 
> deployment environment.
>
> Question: how can I use different context.xml for different environments? 
> Filters don't
> work, because the file is not part of "resources", but webapp/META-INF 
> (because, when it's
> part of resources it gets packaged under WEB-INF/classes).
>
> I'm trying to figure out the best way to do this, using context.xml or 
> external
> configuration files (which will need to be deployed and undeployed each time 
> the web-app
> get's deployed or undeployed)
>
> Thx for any help!
>
> Janek
>
> ---------------------------------------------------------------------
> 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