ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: set a property in a .properties file
Date Tue, 19 Dec 2006 11:21:03 GMT

Hi,

if you want to reset / overwrite an existing property the easiest way is
via script
task and language of your choice (ruby,javascript,groovy ...) , f.e. =

<project name="bla" default="main" basedir=".">
    
    <!-- // Properties -->
    <property name="foo" value="bar"/>
    <!-- Properties // -->

	<target name="depends">

	<!-- using javascript -->
        <script language="javascript">
            <![CDATA[
              project.setProperty("foo","nobar")
            ]]>
        </script>
     
     <!-- using jruby -->
        <script language="ruby">
             <![CDATA[
            $project.setProperty("foo","nobar")
             ]]>
         </script> 
         
	</target>

 
	<target name="main" depends="depends">

<script language="ruby">
 <![CDATA[
         case $foo
            when /^bar/
            puts 'yup, one beer please !!'
            else
            puts 'no beer today ...'
            end
   ]]>
   </script>   

	</target>

Regards, Gilbert
 

-----Original Message-----
From: jm [mailto:jmuguruza@gmail.com] 
Sent: Tuesday, December 19, 2006 11:45 AM
To: Ant Users List
Subject: set a property in a .properties file

hi,

I have been looking for a way to set a property in a .properties file
via ant. Could not find any easy way...somebody knows a way to do it
or a external task or something?

I know about the <replace> stuff, but I am trying to change the
property without knowing the value it had before, that is, I cannot
assume it is 'aproperty=@replaceme@'

thanks,

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message