Ok I figured it out. Here is my working solution:
<profiles>
<profile>
<id>local</id>
<properties>
<region>local</region>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<containerConfigXML>src/main/context.xml</containerConfigXML>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<region>dev</region>
</properties>
</profile>
<profile>
<id>sit</id>
<properties>
<region>sit</region>
</properties>
</profile>
<profile>
<id>uat</id>
<properties>
<region>uat</region>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<region>prod</region>
</properties>
</profile>
</profiles>
From: [email protected]
To: [email protected]
Subject: RE: How to package context.xml based on regions
Date: Thu, 29 Sep 2011 12:55:54 -0500
Thanks Steven. I agree - I didnt want to get into profile kludge.
I've decided to just remove context.xml all together from the project and have
developers cvongiure the datasource manually.
Thanks!
> Date: Thu, 29 Sep 2011 07:48:20 +0100
> Subject: Re: How to package context.xml based on regions
> From: [email protected]
> To: [email protected]
>
> if local builds are being run using jetty:run there are some tricks to allow
> jetty to add the file to the effective webapp so that the war never needs
> context.xml and there is just one and only one war built (thus avoiding the
> nasty profile produces different artifact complaint that people make after a
> while with profiles)
>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 28 Sep 2011 19:51, "Wayne Fay" <[email protected]> wrote:
> >> We use context.xml in our local builds, but when building a war for
> >> other environments, we would like to not include the context.xml file.
> >>
> >> Any ideas on how to exclude context.xml for non-local builds?
> >
> > Any time you have a question like this, the answer is almost always
> > "use a profile."
> >
> > Wayne
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >