How to over-write the property in Ant?

后端 未结 8 1279
旧时难觅i
旧时难觅i 2020-12-05 13:21

Is there a way to re-assign the value for the Ant property task? Or is there another task available for that purpose?

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 14:06

    For the sake of justice, there is a hack that allows to alter ant's immutable properties without any additional libs (since java 6):

    
        
        
            project.setProperty(attributes.get("name"), attributes.get("value"));
    
    

    Usage:

        
        
        ${x}   
    

    As others mentioned, this should be used with care after all canonical approaches proved not to fit.

提交回复
热议问题