Thanks Jan, I created my own task and integrated into my build
process, but initial reason to ask this to the group was that if Ant
has a standard way to achieve this then why I should create seperate
task, at last for my own task I have to maintain and document the
same, which would not have been the case in case of standard Ant task
;-)
Thanks again for your help.
Regards,
Ravi.
On 1/29/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I dont know any task.
> Which means: implement your own ;)
>
> Jan
>
>
> <project>
>
> <scriptdef name="insert" language="javascript">
> <!-- the string where to insert -->
> <attribute name="input"/>
> <!-- the string to insert -->
> <attribute name="string"/>
> <!-- the position where to insert -->
> <attribute name="position"/>
> <!-- property name for the result -->
> <attribute name="property"/>
> <![CDATA[
> // Access to attributes
> pos = attributes.get("position");
> input = attributes.get("input");
> property = attributes.get("property");
> str = attributes.get("string");
>
> // Compute new value
> if (pos >= str.length) {
> newValue = input + str;
> } else {
> newValue = input.substring(0, pos) + str + input.substring(pos);
> }
>
> // Store result
> project.setNewProperty(property, newValue);
> ]]>
> </scriptdef>
>
> <insert input="xx" string="." position="1" property="out"/>
> <echo>${out}</echo>
>
> </project>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Ravi Roy [mailto:[EMAIL PROTECTED]
> > Gesendet: Dienstag, 29. Januar 2008 11:09
> > An: Ant Users List
> > Betreff: Re: How to set a new property based on value of
> > another property in Ant ?
> >
> > On 1/29/08, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> > > You could load different property files according to a base property
> > > <property file="${user.name}.properties"/>
> > >
> > > And with AntContrib you could copy contents
> > > <property name="text.en" value="Hello World"/>
> > > <property name="text.de" value="Hallo Welt"/>
> > > <property name="language" value="en"/>
> > > <antcontrib:propertycopy name="text" from="text.${language}"/>
> > > <echo>${text} = Hello World</echo>
> > >
> > > see also
> > http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
> > >
> > >
> > > Jan
> >
> > Thanks Jan,
> >
> > But initially, I was looking for how to manipulate the string like -
> > pushing "." in between value of the property using ant.
> >
> > Regards,
> > Ravi
> >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Ravi Roy [mailto:[EMAIL PROTECTED]
> > > > Gesendet: Dienstag, 29. Januar 2008 09:53
> > > > An: [email protected]
> > > > Betreff: How to set a new property based on value of another
> > > > property in Ant ?
> > > >
> > > > Hi All,
> > > >
> > > > I want to set a property based on a value of the other
> > property in my
> > > > build script :
> > > >
> > > > Already defined property in a build file :
> > > >
> > > > <property foo.1="prop.1" value="xx" />
> > > >
> > > > Want to set another property based on the value of this
> > property like.
> > > >
> > > > <property foo.2="prop2. value="x.x" />
> > > >
> > > > Which means addding "." character after first character
> > in the value
> > > > of foo.1 property.
> > > >
> > > > Is it possible in ant ?
> > > >
> > > > Thanks for pointers.
> > > >
> > > > Regards,
> > > > Ravi.
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]