Hello Maven users

I am having a problem getting filtering to work with property values. In a
hibernate.cfg.xml I have the database password specified as "${db.password}"
and now I'm trying to get the password in there when it's copied over. I
have:

    <build>
        <filters>
           
<filter>src/main/filters/${env}_${targetHost}.properties</filter>
        </filters>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                 <includes>
                   <include>hibernate.cfg.xml</include>
                 </includes>
            </resource>
        </resources>

        [...]
    </build>

I know this is working since I have some other properties (specified in the
relevant ${env}_${targetHost}.properties) that I'm filtering too, and they
get interpolated correctly.

If I put something like the following in my pom.xml:
    <properties>
       <db.password>${project.groupId}</db.password>
    </properties>

Or
    <properties>
        <db.password>somepasswordvalue</db.password>
    </properties>    

then it works, and the value is substituted correctly.

However, I want to be able to set the password in my settings.xml -- I don't
want to put it in my source code. But if I set a property (say
"db.actual.password") in a profile in my settings.xml and put this in my
pom.xml:
    <properties>
        <db.password>${db.actual.password}</db.password>
    </properties>

then I land up with the string literal ("${db.actual.password}") in my
filtered hibernate.cfg.xml.

I've tested with 'mvn help:effective-settings" that the value of
db.actual.password is being set correctly.

Am I using the filtering mechanism incorrectly? (I would have thought this
is a common sort of use case.) If anyone can point out where I'm going wrong
I'd be grateful ...

Thanks
Toni


--
View this message in context: 
http://www.nabble.com/Problem+with+filtering+on+pom+properties-t1649749.html#a4468317
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to