You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Thanh T." <co...@gmail.com> on 2006/03/17 00:36:40 UTC

[m2] property filtering at runtime question

Hi,
is there a way to filter my properties at run time? I created a plugin
which require properties to filter at run time and it does not seems
to work. The properties filter at build time works flawlessly but I
can not figure out a way to make it work at runtime. i.e. mvn install
(compile and install) works fine. I tried to use Java's Properties to
load properties but that does not seems to filter properties that have
values ${point.to.another.prop}. Here's what I mean.

pom.xml
<project>
   .......
   <build>
        <filters>
            <filter>src/main/filters/filter.properties</filter>
        </filters
        <resources>
            <resource>
                 <directory>src/main/resources</directory>
                 <filtering>true</filtering>
            </resource>
        </resources>
    </build>
    .......
</project>

filter.properties (content)
working.root.dir=c:/temp
target.root.dir=${working.root.dir}/target

test.properties (resources dir)
build.jar.dir=${target.root.dir}/jar

ones the project (plugin) builds, the properties filter works fine.
target.root.dir is replace with c:/temp/target and the build.jar.dir
is replace with c:/temp/target/jar. All these properties is moved to
the ${basedir}/target/classes by default. Basically I like to know if
there is a way to filter these property files using Java (Java's
Properties class does not seems to filter a property that has a
relative property). The reason I want to do this is because I want to
add or change properties within a file without having to rebuild the
plugin and allow a property file to locate else where, other then the
resource dir thanks.


--
Thanh T.ICQ #: 10381946

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