Is there a way to pull a substring from an Ant property and place that substring into it's own property?
相关问题
- How can I have my ant task pass or fail based on t
- Ant inheriting Maven properties
- How can I zip multiple folders individually with a
- Class in jar not found at runtime, but was used to
- Regex to select last line in a multi-line string
相关文章
- Passing command line arguments to Java via ant bui
- ANT - Could not load a dependent class com/jcraft/
- library resolve to a path with no project.properti
- ant file that depends on another ant file
- android-sdk/tools/ant/build.xml:698: null returned
- ant jar's mainclass
- Integrate Ant builder into Eclipse: Error “Variabl
- How can I avoid this Ant Build error?
i would use script task for that purpose, i prefer ruby, example cut off the first 3 chars =
output =
using the ant api with method project.setProperty() on an existing property will overwrite it, that way you can work around standard ant behaviour, means properties once set are immutable
Since I prefer to use vanilla Ant, I use a temporary file. Works everywhere and you can leverage replaceregex to get rid of the part of the string you don't want. Example for munging Git messages:
I would go with the brute force and write a custom Ant task:
What's left it to implement the
String process(String)
and add a couple of setters (e.g. for theoldproperty
andnewproperty
values)I use scriptdef to create a javascript tag to substring, for exemple:
You could try using PropertyRegex from Ant-Contrib.