You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Büchler <ma...@bsmo.de> on 2007/11/08 23:51:45 UTC
How to override properties selectively with multiple filter files or profiles
Hello,
I am still stuck with a mechanism, that I used a lot when writing
build and deploy systems for many developers and configurations with
ant. The main goal here is to avoid redundancy when listing
configuration properties, using a default build.properties and then
selectively override special property setting for a developers
enviromnent or for the target systems. Example:
build.xml:
<propertyfile name="${user.name}.properties"/>
<propertyfile name="${hostname}.properties"/>
<propertyfile name="build.properties"/>
buid.properties:
prop1=val1
prop2=val2
prop3=val3
prop4=val4
prop5=val5
hostname.properties:
prop2=otherval
user.properties:
prop5=otherval
That way I never have to touch all existing properties, if I add a
new config value, i.e. to build.properties.
If I use profiles to modify the build element of the POM, I have to
inject a quite complete copy of the original build element. And, if I
try to list multiple filters int the filters element, the behaviour
is also not very obvious. Seems that only one of the
filter.properties files is in effect.
Is there a way to adjust properties non-redundant when using
profiles, or did I miss a maven feature, that does exactly that?
Thank you for reading
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to override properties selectively with multiple filter
files or profiles
Posted by nodje <no...@gmail.com>.
I'm currently having the same problem as below. Not migrating from ant
though, but I need to be able to filter different set of properties having
the same name.
I don't think it's possible to affect a specific filter to a chosen
resource.
To illustrate, let's say you have two instances of an FTP module in your
main application.
These modules must be given a properties file for configuration.
ftp1.properties and ftp2.properties. Those two properties files hold the
exact same set of properties.
If one need to filter them, for say, different staging environment, one has
to find a trick. Unless I'm mistaken.
i'm about to code a complex system of prefix to be given to these set of
properties to be able to differentiate them. After some thinking, I'd rather
be able to affect a specific filter to a resource and be able to configure
multiple filters.
Is this already possible with Maven? Has anyone be confronted with that
problem?
cheers
Martin Buechler-3 wrote:
>
> Hello,
>
> I am still stuck with a mechanism, that I used a lot when writing
> build and deploy systems for many developers and configurations with
> ant. The main goal here is to avoid redundancy when listing
> configuration properties, using a default build.properties and then
> selectively override special property setting for a developers
> enviromnent or for the target systems. Example:
>
> build.xml:
>
> <propertyfile name="${user.name}.properties"/>
> <propertyfile name="${hostname}.properties"/>
> <propertyfile name="build.properties"/>
>
> buid.properties:
>
> prop1=val1
> prop2=val2
> prop3=val3
> prop4=val4
> prop5=val5
>
> hostname.properties:
>
> prop2=otherval
>
>
> user.properties:
>
> prop5=otherval
>
> That way I never have to touch all existing properties, if I add a
> new config value, i.e. to build.properties.
>
> If I use profiles to modify the build element of the POM, I have to
> inject a quite complete copy of the original build element. And, if I
> try to list multiple filters int the filters element, the behaviour
> is also not very obvious. Seems that only one of the
> filter.properties files is in effect.
>
> Is there a way to adjust properties non-redundant when using
> profiles, or did I miss a maven feature, that does exactly that?
>
> Thank you for reading
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-to-override-properties-selectively-with-multiple-filter-files-or-profiles-tp13662475p19454645.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org