You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bernier David <db...@sopragroup.com> on 2007/06/14 10:38:42 UTC

[Maven Properties] : Using a filter property directly in my pom.xml

Hi all,
I'm a new user on Maven since few weeks and i'd like to know how can i
use a property defined in a filter properties file directly in my
pom.xml ?
Here is an example :
    * the file filter.properties contains this property :
        my_prop=a_value
 
    * in my pom.xml i have :
       <project>
            <build>
                <filters>
 
<filter>[path_to_filter_dir]/filter.properties</filter>
                </filters>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.0.2</version>
                        <configuration>
                            <!-- I want to use my_prop here but i can't
(the ${my_prop} isn't replaced by the value)-->
 
<webappDirectory>${my_prop}</webappDirectory>
                            <webResources>
                                <resource>
                                    <!-- my_prop is used too in some
files under [path_to_resource_dir] -->
 
<directory>[path_to_resource_dir]</directory>
 
<target>[path_to_target_dir]</target>
                                    <filtering>true</filtering>
                                </resource>
                            </webResources>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </project>
 
Alternatively, in the POM reference there is this sentence : x: Set
within a <properties /> element or an external files, the value may be
used as ${someVar}.
How can i use an external file containg my property used in the pom.xml
in an another ways than defining this property in the user's
settings.xml file ?
 
Please help me.
                
/David BERNIER
 


Re: [Maven Properties] : Using a filter property directly in my pom.xml

Posted by Steven Rowe <sa...@syr.edu>.
Hi David,

Bernier David wrote:
> I'm a new user on Maven since few weeks and i'd like to know how can i
> use a property defined in a filter properties file directly in my
> pom.xml ?
[snip]
> How can i use an external file containg my property used in the pom.xml
> in an another ways than defining this property in the user's
> settings.xml file ?

properties-maven-plugin might do the trick for you:

  <http://arsenalist.com/2007/02/07/maven-properties-plugin-download/>

Steve


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