{"id":234,"date":"2013-07-30T11:39:37","date_gmt":"2013-07-30T11:39:37","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=234"},"modified":"2013-08-26T12:20:51","modified_gmt":"2013-08-26T12:20:51","slug":"apache-ant-tutorial-2","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/apache-ant-tutorial-2\/","title":{"rendered":"Apache ANT Tutorial  2"},"content":{"rendered":"<p><strong>How to Run a Java file from ANT Script<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n &lt;java classname=&quot;com.mugil.tutor.Sample&quot;&gt;\r\n   &lt;classpath path=&quot;test\/classes\/&quot;&gt;&lt;\/classpath&gt;\r\n &lt;\/java&gt;\r\n<\/pre>\n<p>Where Sample points to <strong>Sample.class<\/strong> which we got through compilation and <strong>test\/classes\/<\/strong> contains the Sample.class file. Below is the whole code in build.xml file<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;project name=&quot;ANT2&quot; default=&quot;copyTarget&quot;&gt;\r\n  &lt;target name=&quot;copyTarget&quot;&gt;\r\n  &lt;mkdir dir=&quot;test\/classes\/&quot;\/&gt;\r\n  &lt;javac srcdir=&quot;src\/com\/mugil\/tutor\/&quot; destdir=&quot;test\/classes\/&quot; includeantruntime=&quot;false&quot;&gt;&lt;\/javac&gt;\r\n    &lt;java classname=&quot;com.mugil.tutor.Sample&quot;&gt;\r\n  \t&lt;classpath path=&quot;test\/classes\/&quot;&gt;&lt;\/classpath&gt;\r\n     &lt;\/java&gt;\r\n   &lt;\/target&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<p><strong>How to get Current time in ANT Script<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n &lt;project name=&quot;default&quot; default=&quot;target1&quot;&gt;\r\n     &lt;target name=&quot;target1&quot;&gt;\t\t\r\n\t&lt;tstamp&gt;\r\n\t   &lt;format property=&quot;current.time&quot; pattern=&quot;yyyyMMdd&quot; \/&gt;\r\n\t   &lt;format property=&quot;archive.name&quot; pattern=&quot;'MyArchive_'yyyyMMdd_hh:mmaa'.jar'&quot; \/&gt;\r\n\t&lt;\/tstamp&gt;\r\n\t&lt;echo&gt;${current.time}&lt;\/echo&gt;\r\n\t&lt;echo&gt;${archive.name}&lt;\/echo&gt;\t\t\r\n     &lt;\/target&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<p><strong>ANT Script to concatenate two variables and Create directory based on that<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;project name=&quot;default&quot; default=&quot;target1&quot;&gt;\r\n  &lt;property name=&quot;mugil.dir&quot; value=&quot;D:\/Mugilvannan\/&quot;\/&gt;\t\t\r\n     &lt;target name=&quot;target1&quot;&gt;\t\t\r\n\t&lt;tstamp&gt;\r\n\t  &lt;format property=&quot;current.time&quot; pattern=&quot;yyyyMMdd&quot; \/&gt;\r\n\t  &lt;format property=&quot;archive.name&quot; pattern=&quot;'MyArchive_'yyyyMMdd_hhmmaa&quot; \/&gt;\r\n\t&lt;\/tstamp&gt;\r\n\t&lt;property name=&quot;whole.dir&quot; value=&quot;${mugil.dir}${archive.name}&quot;\/&gt;\r\n\t  &lt;echo&gt;\r\n\t    ${whole.dir}\r\n\t  &lt;\/echo&gt;\t\t\r\n\t&lt;mkdir dir=&quot;${whole.dir}&quot;&gt;&lt;\/mkdir&gt;\r\n     &lt;\/target&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to Run a Java file from ANT Script &lt;java classname=&quot;com.mugil.tutor.Sample&quot;&gt; &lt;classpath path=&quot;test\/classes\/&quot;&gt;&lt;\/classpath&gt; &lt;\/java&gt; Where Sample points to Sample.class which we got through compilation and test\/classes\/ contains the Sample.class file. Below is the whole code in build.xml file &lt;project name=&quot;ANT2&quot; default=&quot;copyTarget&quot;&gt; &lt;target name=&quot;copyTarget&quot;&gt; &lt;mkdir dir=&quot;test\/classes\/&quot;\/&gt; &lt;javac srcdir=&quot;src\/com\/mugil\/tutor\/&quot; destdir=&quot;test\/classes\/&quot; includeantruntime=&quot;false&quot;&gt;&lt;\/javac&gt; &lt;java classname=&quot;com.mugil.tutor.Sample&quot;&gt; &lt;classpath path=&quot;test\/classes\/&quot;&gt;&lt;\/classpath&gt; &lt;\/java&gt; &lt;\/target&gt;&hellip; <a href=\"https:\/\/codethataint.com\/blog\/apache-ant-tutorial-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-ant"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":6,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}