You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Balasubramanian, Ravi Shankar" <rb...@informatica.com> on 2007/03/22 06:13:46 UTC

Using properties from external file in pom.xml

Hi all,

I have posted this before and have not got a solution for this. My
requirement is to have some name,value pairs defined in external
properties file like "username.properies" in the local drive and my
pom.xml would be wanting the values for those parameters substituted in
them. Something like picking up properties from build.properties in ant.


 

How do I do this with maven? I am using maven version 2.0.4. 

 

To be clear, I would have a properties file called "maven.propeties" as
follows:

"

test_outdir = C:\test

result_dir = C:\test\result 

.

.

"

 

I want to be using these in the pom.xml as follows:

<plugin>

....<configuration>

             <outDir>${test_outdir}</outDir>

 

 

I understand that this can be done by defining the properties in the
settings.xml under the properties element. However, my requirement is to
read them from a user's properties file as mentioned above.

 

Regards,

Ravi.

"Tough times never last, but tough men do..."

 


Re: Using properties from external file in pom.xml

Posted by Wayne Fay <wa...@gmail.com>.
With a stock Maven install, this is not available, without some customization.

Other people have written their own plugin to read their properties
files and add the properties to the pom/profile etc. But this requires
you to write your own mojo/plugin, and I don't have any example code
to offer, I just know it has been done as others have mentioned it on
this list previously.

Wayne

On 3/21/07, Balasubramanian, Ravi Shankar <rb...@informatica.com> wrote:
> Hi all,
>
> I have posted this before and have not got a solution for this. My
> requirement is to have some name,value pairs defined in external
> properties file like "username.properies" in the local drive and my
> pom.xml would be wanting the values for those parameters substituted in
> them. Something like picking up properties from build.properties in ant.
>
>
>
>
> How do I do this with maven? I am using maven version 2.0.4.
>
>
>
> To be clear, I would have a properties file called "maven.propeties" as
> follows:
>
> "
>
> test_outdir = C:\test
>
> result_dir = C:\test\result
>
> .
>
> .
>
> "
>
>
>
> I want to be using these in the pom.xml as follows:
>
> <plugin>
>
> ....<configuration>
>
>              <outDir>${test_outdir}</outDir>
>
>
>
>
>
> I understand that this can be done by defining the properties in the
> settings.xml under the properties element. However, my requirement is to
> read them from a user's properties file as mentioned above.
>
>
>
> Regards,
>
> Ravi.
>
> "Tough times never last, but tough men do..."
>
>
>
>

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