You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Frank Russo <fr...@FXALL.com> on 2005/12/19 22:36:16 UTC
RE: Defining Resources [Solution if Interested]
Using the command: mvn -Denv=dev clean package
The first resource (see pom below) picks up the env=dev and loads all
files under src/main/resources/dev.
The second resource picks up the .properties in src/main/resources. I
haven't tried *.* in the include, but it may work to pick up everything.
In pom:
<build>
<resources>
<resource>
<directory>src/main/resources/${environment}</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
</build>
...
<profiles>
<profile>
<id>environmentVariable-dev</id>
<activation>
<property>
<name>env</name>
<value>dev</value>
</property>
</activation>
<properties>
<environment>dev</environment>
</properties>
</profile>
<profile>
<id>environmentVariable-qa</id>
<activation>
<property>
<name>env</name>
<value>qa</value>
</property>
</activation>
<properties>
<environment>qa</environment>
</properties>
</profile>
<profile>
<id>environmentVariable-int</id>
<activation>
<property>
<name>env</name>
<value>int</value>
</property>
</activation>
<properties>
<environment>int</environment>
</properties>
</profile>
<profile>
<id>environmentVariable-prod</id>
<activation>
<property>
<name>env</name>
<value>prod</value>
</property>
</activation>
<properties>
<environment>prod</environment>
</properties>
</profile>
</profiles>
Frank Russo
Senior Developer
FX Alliance, LLC
> -----Original Message-----
> From: Frank Russo
> Sent: Tuesday, December 13, 2005 4:02 PM
> To: users@maven.apache.org
> Subject: Defining Resources
>
>
> I have the following configuration for resources:
>
> src/main/resources (Contains files for building any war)
> src/main/resources/dev (Contains files for building only the
> development war)
> src/main/resources/qa (Contains files for building only the
> qa war)
> src/main/resources/prod (Contains files for building only the
> production war)
>
> In my pom, I have the following set up for resources:
>
> <resources>
> <resource>
> <directory>src/main/resources/${environment}</directory>
> <filtering>true</filtering>
> </resource>
> <resources>
>
> ${environment} is defined in a profile in pom as well. This
> allows me to only pull the files from the folder for which
> I'm building, i.e. if I'm building for dev, only the files
> from the dev folder will be included in my war, etc.
>
> I also need to be able to build the war with the files in
> src/main/resources. There are files here that are general
> files that are not environment specific.
>
> I tried added the following two solutions:
>
> 1. <resource>
> <directory>src/main/resources</directory>
> <filtering>true</filtering>
> </resource>
> 2. <resource>
> <directory>src/main/resources/*.*</directory>
> <filtering>true</filtering>
> </resource>
>
> Neither of these seem to work. Only the environment specific
> files are being including in the war.
>
> Does anyone know how to accomplish this?
>
> Thanks...
> Frank Russo
> Senior Developer
> FX Alliance, LLC
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org