Andy Jarrett // Code. Develop. Manage.

Ant- Passing attributes to Build.xml

Critter on a previous post asked "if you can pass in attributes to the build.xml file?" From the Terminal this is as easy as adding another argument "-D". -D<property>=<value>
This will update a property in you build.xml file with the value you passed inFor example you would use something similar toant -buildfile ~/desktop/build.xml -DechoMsg=NewEchoMessagePutting this into practice here is a sample build.xml which I am going to save to my Desktop From the Terminal no runant -buildfile ~/desktop/build.xml -DechoMsg='I overwrite the echo message'In your terminal window you should see something likeBuildfile: [PATH TO BUILD FILE]build.xmlrunEcho:[echo] I overwrite the echo messageBUILD SUCCESSFULTotal time: 0 seconds
I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee.
Your support keeps this site running and the coffee brewing! ☕️