You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rick Mangi <rm...@yahoo.com> on 2005/02/14 02:08:31 UTC

Variable Sub. in Conf Files?

Hello all,

I'm wondering if there is an easy way to do variable substitution in 
config files (e.g. log4j.conf, hibernate.conf) as they are moved into 
the target directory.

So for example, I'd like to be able to use a placeholder variable in a 
conf file, put default values in project.properties and give developers 
the option to override them with local settings in build.properties. 
The values would be substituted in the files as they are moved into the 
target.

Thanks,

Rick


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


Re: Variable Sub. in Conf Files?

Posted by Brett Porter <br...@gmail.com>.
I know... I opened it before I became a committer :)

This will be addressed in m2 (currently working through the proposal
in terms of profiles). Kenney has already atttached a patch to the MNG
issue if anyone needs filtering for m2 today (though it won't be
compatible with the final solution I don't think).

- Brett

On 5/16/05, Felipe Leme <ma...@felipeal.net> wrote:
> Brett/Rick,
> 
> First of all, sorry for just sending this message 3 months after the
> original, but just now I got some time to loop over the 2k+ message I
> haven't read yet :-(
> 
> Anyway, just FYI, there is a JIRA issue regarding this feature:
> 
> http://jira.codehaus.org/browse/MAVEN-514
> 
> The issues seems dead for a long time, so maybe we should add the
> FAQ/Wiki information on it.
> 
> -- Felipe
> 
> 
> On Mon, 2005-02-14 at 12:18 +1100, Brett Porter wrote:
> > http://www.apache.org/~brett/maven-stage-site/faq.html#filtering-resources
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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


Re: Variable Sub. in Conf Files?

Posted by Felipe Leme <ma...@felipeal.net>.
Brett/Rick,

First of all, sorry for just sending this message 3 months after the
original, but just now I got some time to loop over the 2k+ message I
haven't read yet :-(

Anyway, just FYI, there is a JIRA issue regarding this feature:

http://jira.codehaus.org/browse/MAVEN-514


The issues seems dead for a long time, so maybe we should add the
FAQ/Wiki information on it.

-- Felipe



On Mon, 2005-02-14 at 12:18 +1100, Brett Porter wrote:
> http://www.apache.org/~brett/maven-stage-site/faq.html#filtering-resources
> 



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


Re: Variable Sub. in Conf Files?

Posted by Brett Porter <br...@gmail.com>.
http://www.apache.org/~brett/maven-stage-site/faq.html#filtering-resources


On Sun, 13 Feb 2005 20:08:31 -0500, Rick Mangi <rm...@yahoo.com> wrote:
> Hello all,
> 
> I'm wondering if there is an easy way to do variable substitution in
> config files (e.g. log4j.conf, hibernate.conf) as they are moved into
> the target directory.
> 
> So for example, I'd like to be able to use a placeholder variable in a
> conf file, put default values in project.properties and give developers
> the option to override them with local settings in build.properties.
> The values would be substituted in the files as they are moved into the
> target.
> 
> Thanks,
> 
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org 
> For additional commands, e-mail: users-help@maven.apache.org 
> 
>

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


Re: Variable Sub. in Conf Files?

Posted by Tim Stephenson <ts...@gmail.com>.
Hi, 

You can still use Ant's 'replace' 
    http://ant.apache.org/manual/CoreTasks/replace.html
and ReplaceRegEx 
    http://ant.apache.org/manual/OptionalTasks/replaceregexp.html
tasks in your maven.xml file. 

So you could write a preGoal something like this (I stress I haven't
tested it but it should give you the idea).

  <preGoal name="jar">
    <replace file="${maven.src.dir}/log4j.conf"
                 value="${context.getVariable('myprop')}"/>
  </preGoal>

hope this helps, Tim 

On Sun, 13 Feb 2005 20:08:31 -0500, Rick Mangi <rm...@yahoo.com> wrote:
> Hello all,
> 
> I'm wondering if there is an easy way to do variable substitution in
> config files (e.g. log4j.conf, hibernate.conf) as they are moved into
> the target directory.
> 
> So for example, I'd like to be able to use a placeholder variable in a
> conf file, put default values in project.properties and give developers
> the option to override them with local settings in build.properties.
> The values would be substituted in the files as they are moved into the
> target.
> 
> Thanks,
> 
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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