Getting Started with Ant


  • Download the ant zip from ant repo online. Unzip it to the desired location. Give the path as below in the environment variable and restart. Need to take care of the java -version required for the given ant. For example the 1.10 ant version will require Java 1.8.

 
 
  • To build first ant file and also run a XSLT transformation: create a file named build.xml with the following content:
      build.xml:
       
<project name="first_project">
<target name="FirstXSLT">
<xslt in="FirstInput.xml" out="FirstOutput.xml" style="FirstTransform.xslt">
</xslt>
</target>
</project>
firstInput.xml:
       
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Input>Hi</Input>
</root>
FirstTransform.xslt:
       
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<FirstMessage>Hello World!</FirstMessage>
</xsl:template>
</xsl:stylesheet>
  • Put all the above file in the same location. Go to the location of the file build.xml. >ant MyXSLT, should produce an output MyOutput.xml with the following content:
   Output:
    

FirstOutput.xml:
       
<?xml version="1.0" encoding="UTF-8"?><FirstMessage>Hello World!</FirstMessage>
  • To use math operations in Ant, use antcontrib jar, download. Then add it to the lib folder of the ant installation. 

Comments

  1. leovegas | Casino Online | Get 150 Spins - Gold Casino
    Play Slots at the best online casino. Get 150 dafabet Free Spins for a 100% match bonus at the leovegas hottest Slots Games! fun88 vin

    ReplyDelete

Post a Comment

Popular posts from this blog

Adding custom domain to google blogger

CMD commands