Ibolit
Ibolit

Reputation: 9740

Read param from web.xml in Ant build script

I want to be able to build my webapp in several variants, using as few configuration parameters as possible. I want to be able to just specify the folder in relation to the root of the URL into which i want it to deploy (that is, if i want it to be at http://example.com/one/, i want to specify just the word "one" in my config file).

I don't want to have several web.xml files or several build targets. Also, I know that it is not possible to modify web.xml by ant without using some external scripts. In this respect,

Is it possible to read a parameter from my web.xml file from an Ant script and then use the value in building?

Upvotes: 1

Views: 841

Answers (1)

Patrice M.
Patrice M.

Reputation: 4319

You can read and modify any node/attribute from an XML file using XPath via the external xmltask : http://www.oopsconsultancy.com/software/xmltask/, http://today.java.net/pub/a/today/2006/11/01/xml-manipulation-using-xmltask.html.

This widely-used ant task is very reliable.

Upvotes: 1

Related Questions