You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nathan Maves <na...@gmail.com> on 2007/06/11 16:27:36 UTC

Better solution then filtering?

First off great product!

I am using filtering for all of my property files that differ from multiple
environments (dev, uat, prod).  I am a little stuck on how to filter files
that differ dramatically from env to env.  One such file is a log4j
properties file.  We have very different files depending on env.  Is there
any way, without using ant, to copy these files to the target directories
based on which profile is used.


Nathan

RE: Better solution then filtering?

Posted by Arnaud Jeansen <ar...@calyon.com>.
I was not fast enough... Some people on this list are insanely fast :)

Anyway, the question was asked a few weeks ago, and here was my reply:

http://www.nabble.com/Bundling-a-particular-set-of-files%28Environment%2
9-inside-War-project-tf3823795s177.html#a10892562

It might save you some time over experimenting by yourself.

Arnaud

-----Original Message-----
From: Nathan Maves [mailto:nathan.maves@gmail.com] 
Sent: lundi 11 juin 2007 17:35
To: Maven Users List
Subject: Re: Better solution then filtering?

Not sure how I over looked that but it should work great for what I am
doing.

Thanks Dirk

On 6/11/07, Dirk Olmes <di...@xanthippe.ping.de> wrote:
>
> Nathan Maves wrote:
> > First off great product!
> >
> > I am using filtering for all of my property files that differ from
> multiple
> > environments (dev, uat, prod).  I am a little stuck on how to filter
> files
> > that differ dramatically from env to env.  One such file is a log4j
> > properties file.  We have very different files depending on env.  Is
> there
> > any way, without using ant, to copy these files to the target
> directories
> > based on which profile is used.
>
> One way would be to define profiles for your various environments. In
> each profile, configure the resources section. (A look at
> http://maven.apache.org/ref/current/maven-model/maven.html helps how
to
> do that).
>
> Your project doesn't have a single resources dir then, but one for
each
> profile (and one for resources that are the same on all profiles,
maybe)
>
> -dirk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Better solution then filtering?

Posted by Nathan Maves <na...@gmail.com>.
Not sure how I over looked that but it should work great for what I am
doing.

Thanks Dirk

On 6/11/07, Dirk Olmes <di...@xanthippe.ping.de> wrote:
>
> Nathan Maves wrote:
> > First off great product!
> >
> > I am using filtering for all of my property files that differ from
> multiple
> > environments (dev, uat, prod).  I am a little stuck on how to filter
> files
> > that differ dramatically from env to env.  One such file is a log4j
> > properties file.  We have very different files depending on env.  Is
> there
> > any way, without using ant, to copy these files to the target
> directories
> > based on which profile is used.
>
> One way would be to define profiles for your various environments. In
> each profile, configure the resources section. (A look at
> http://maven.apache.org/ref/current/maven-model/maven.html helps how to
> do that).
>
> Your project doesn't have a single resources dir then, but one for each
> profile (and one for resources that are the same on all profiles, maybe)
>
> -dirk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Better solution then filtering?

Posted by ml...@planwerk6.de.
Am Montag, 11. Juni 2007 16:40 schrieb Dirk Olmes:
> Nathan Maves wrote:
> > First off great product!
> >
> > I am using filtering for all of my property files that differ from
> > multiple environments (dev, uat, prod).  I am a little stuck on how to
> > filter files that differ dramatically from env to env.  One such file is
> > a log4j properties file.  We have very different files depending on env. 
> > Is there any way, without using ant, to copy these files to the target
> > directories based on which profile is used.
>
> One way would be to define profiles for your various environments. In
> each profile, configure the resources section. (A look at
> http://maven.apache.org/ref/current/maven-model/maven.html helps how to
> do that).

i use filtering AND special resource directories:

	<profiles>
		<profile>
			<id>development</id>
			<activation>
				<property>
					<name>env</name>
					<value>development</value>
				</property>
			</activation>
			<build>
				<resources>
					<resource>
						<filtering>true</filtering>
						<directory>src/main/resources/</directory>
					</resource>
					<resource>
						<filtering>true</filtering>
						<directory>
							src/main/development-resources
						</directory>
					</resource>
				</resources>
			</build>
        		<properties>
				<hibernate.show_sql>true</hibernate.show_sql>
				<hibernate.format_sql>true</hibernate.format_sql>
			</properties>
		</profile>
	</profiles>

In your main build section:
	<build>
		<resources>
			<resource>
				<filtering>true</filtering>
				<directory>src/main/resources/</directory>
			</resource>
		</resources>
        </build>

You can have a log4j.properties in src/main/resources and in 
src/main/development-resources and the first one gets overwritten by the 
second one IF development profil is active

kind regards,
Janning



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Better solution then filtering?

Posted by Dirk Olmes <di...@xanthippe.ping.de>.
Nathan Maves wrote:
> First off great product!
> 
> I am using filtering for all of my property files that differ from multiple
> environments (dev, uat, prod).  I am a little stuck on how to filter files
> that differ dramatically from env to env.  One such file is a log4j
> properties file.  We have very different files depending on env.  Is there
> any way, without using ant, to copy these files to the target directories
> based on which profile is used.

One way would be to define profiles for your various environments. In
each profile, configure the resources section. (A look at
http://maven.apache.org/ref/current/maven-model/maven.html helps how to
do that).

Your project doesn't have a single resources dir then, but one for each
profile (and one for resources that are the same on all profiles, maybe)

-dirk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org