How to replace backslashes to slashes for ${basedir} property in maven profile profile

I have a pom.xml with defined property module.basedir that is intended to contain transformed basedir property. It is defined as follows:

<properties>
    <module.basedir>${basedir}</module.basedir>
</properties>

And I have following code that is executed using mgroovy plugin:

<source>
    println project.properties['module.basedir']
    project.properties['module.basedir']=project.properties['module.basedir'].replace('\\','/');
    println project.properties['module.basedir']
</source>

Later I use this property in other plugins. This works fine until I move plugin definitions into maven profile. And when maven profile is activated mgroovy plugin works fine, but when I access property in the next plugin I get unmodified value.

This is how I access this property:

${module.basedir}

It looks like that when profile is executed it creates own copies of properties defined in project and they are used when referenced from plugins.

Any suggestions?

6
задан Igor Nikolaev 4 December 2010 в 10:38
поделиться