Is it possible to replace text in properties in Ant's build.xml?

前端 未结 5 1951
没有蜡笔的小新
没有蜡笔的小新 2021-01-06 15:41

I have a property, app.version, which is set to 1.2.0 (and, of course, always changing) and need to create zip file with name \"something-ver-1_2_0\". Is this possible?

5条回答
  •  长发绾君心
    2021-01-06 16:36

    Since the property app.version is always changing i assume you don't want to hard code it into the properties files, rather pass it when you do the build. Further to this answer, you can try the following on the command line;

    ant -f build.xml -Dapp.version=1.2.0
    

    changing app.version to the one required then.

    Edit:

    Understood better your question from the feedback. Unfortunately ant does not have string manipulation tasks, you need to write you own task for this. Here is a close example.

提交回复
热议问题