user4332327
user4332327

Reputation:

Edit file based on jar property using ant

I am VERY new to using ant. I want to build a jar and edit a file only if my flag condition is 1

Right now I have some code:

<target name = "create_jar">
    <script language="javascript">
    ...
        create_jar.setProperty("flag", flag);//where flag is some boolean value
    </script>

    //if "${flag}" = 1
       //then:
        <replaceregexp ...></replaceregexp>

    //else continue as usual
    ...

If any one could help me make out what should be in my if flag = 1 statements it would be much appreciated.

Just to be concise, my replaceregexp works and my script works to get me the right value

EDIT running apache ant version 1.9.2

Upvotes: 2

Views: 32

Answers (1)

user4332327
user4332327

Reputation:

So after some more searching it appears I want to use:

<project name="create_jar" xmlns:if="ant:if" xmlns:unless="ant:unless">
...
...
    <replace... if:true="${flag}">
    <replace... unless:true="${flag}">
...

when using ant > 1.9.1

Upvotes: 3

Related Questions