You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dennis Ho <dh...@paymentone.com> on 2005/11/22 03:18:14 UTC
[M2]How to use filtering with build profiles?
Hi,
I am trying to use filtering to filter different properties file
based on whether the profile is for myself, or dev, per say. An
abstract of my pom looks like the following:
<project>
:
:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>${my.filter.value}</filter>
</filters>
</build>
<profiles>
<profile>
<id>env-dho</id>
<activation>
<property>
<name>env</name>
<value>dho</value>
</property>
</activation>
<properties>
<my.filter.value>src/main/filters/env-dho/filter.properties</my.filter.v
alue>
<db.username>test</db.username>
</properties>
</profile>
<profile>
<id>env-dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<my.filter.value>src/main/filters/env-dev/filter.properties</my.filter.v
alue>
</properties>
</profile>
</profiles>
</project>
But after running mvn -Denv=dho process-resources, the file's
properties didn't get filtered. The file just got copied over. What
have I done wrong?
The file in the resources directory looks like, which after running
process-resources remains unchanged:
db.drivername=${db.drivername}
db.urlscheme=${db.urlscheme}
db.hostname=${db.hostname}
db.name=${db.name}
db.username=${db.username}
db.password=${db.password}
db.port=${db.port}
And my filter.properties looks like:
db.drivername=com.inet.tds.TdsDriver
db.urlscheme=jdbc:inetdae7:
db.hostname=host
db.name=dbname
db.username=user
db.password=password
db.port=1433
Thanks,
Dennis Ho
Senior Java Developer
PaymentOne
. : Office - 408.362.4237
. : www.paymentone.com . : dho@paymentone.com
. : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . : .
. : Connecting Digital Merchants and Network Operators
. : Named One of Forbes "Top Ten to Watch in 2005"