{"id":1892,"date":"2017-12-06T10:19:18","date_gmt":"2017-12-06T10:19:18","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1892"},"modified":"2020-01-09T09:42:34","modified_gmt":"2020-01-09T09:42:34","slug":"sample-apache-ant-assignment-try-it-out","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/sample-apache-ant-assignment-try-it-out\/","title":{"rendered":"Sample Apache ant assignment &#8211; try it out"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Sample Apache ant assignment &#8211; try it out<\/strong><br \/>\nClone the prject- <a href=\"http:\/\/github.com\/scmgalaxy\/helloworld-java-ant\" target=\"_blank\" rel=\"noopener\">github.com\/scmgalaxy\/helloworld-java-ant<\/a> <\/p>\n<p>Duplicate 10 source file from HelloWorld.java<br \/>\nCreate a directory called &#8220;mybuild&#8221;<br \/>\nClean all 10 java class files if exist<br \/>\ncompile only 5 java files<br \/>\nCopy rest 5 files under folder called &#8220;no-need-to-compile&#8221;<br \/>\ncreate package of jar \/ war of the compiled files<br \/>\nNote: must use echo in all programs<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>crystal2904 replied the topic: Sample Apache ant assignment &#8211; try it out<\/strong>\n<project name=\"MyProject\" basedir=\".\" default=\"package\">\n<property name=\"src.dir\" value=\"src\"\/>\n<property name=\"build.dir\" value=\"mybuild\"\/>\n<property name=\"classes.dir\" value=\"${build.dir}\/classes\"\/>\n<property name=\"jar.dir\" value=\"${build.dir}\/jar\"\/>\n<property name=\"no-need-to-compile\" value=\"${build.dir}\/no-need-to-compile\" \/>\n<p><target name=\"clean\"><br \/>\n<echo message=\"We are in cleaning target.........\"\/><br \/>\n<delete dir=\"${build.dir}\"\/><br \/>\n<echo message=\"Cleaning is done...\"\t\/><br \/>\n<\/target><\/p>\n<p><target name=\"compile\" depends=\"clean\"><br \/>\n<echo message=\"Its time to compile only 5 files.... start Compiling\" \/><br \/>\n<mkdir dir=\"${classes.dir}\"\/><br \/>\n<javac includeantruntime=\"false\" srcdir=\"${src.dir}\" destdir=\"${classes.dir}\" ><br \/>\n<include name=\"HelloWorld.java\" \/><br \/>\n<include name=\"HelloWorld1.java\" \/><br \/>\n<include name=\"HelloWorld2.java\" \/><br \/>\n<include name=\"HelloWorld3.java\" \/><br \/>\n<include name=\"HelloWorld4.java\" \/><br \/>\n<\/javac><br \/>\n<echo message=\"Compiled.....\"\/><br \/>\n<\/target><\/p>\n<p><target name=\"mkdir\" depends=\"compile\"><br \/>\n<echo message=\"First Creating the directory\" \/><br \/>\n<mkdir dir=\"${no-need-to-compile}\"\/><br \/>\n<echo message=\"Directory Created\"\/><br \/>\n<\/target><\/p>\n<p><target name=\"copy\" depends=\"mkdir\"><br \/>\n<echo message=\"Going to copy the remaining filw which are not compiled to ${no-need-to-compile} folder\" \/><br \/>\n<copy todir=\"${no-need-to-compile}\" ><br \/>\n<fileset dir=\"${src.dir}\" ><br \/>\n<exclude name=\"HelloWorld.java\" \/><br \/>\n<exclude name=\"HelloWorld1.java\" \/><br \/>\n<exclude name=\"HelloWorld2.java\" \/><br \/>\n<exclude name=\"HelloWorld3.java\" \/><br \/>\n<exclude name=\"HelloWorld4.java\" \/><br \/>\n<\/fileset><br \/>\n<\/copy><br \/>\n<echo message=\"Files are moved\" \/><br \/>\n<\/target><\/p>\n<p><target name=\"package\" depends=\"copy\"><br \/>\n<echo message=\"Now building the jar .... \" \/><br \/>\n<mkdir dir=\"${jar.dir}\"\/><br \/>\n<jar destfile=\"${jar.dir}\/${ant.project.name}.jar\" basedir=\"${classes.dir}\"><\/p>\n<p><\/jar><br \/>\n<echo message=\"You know something jar is built\"\/><br \/>\n<\/target><\/p>\n<p><target name=\"clean-build\" depends=\"clean,package\"\/><\/p>\n<\/project>\n<p><strong>rajeshkumar replied the topic: Sample Apache ant assignment &#8211; try it out<\/strong><br \/>\nThere are some issues in terms of understanding the requirement but its a good start to you.<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Sample Apache ant assignment &#8211; try it out Clone the prject- github.com\/scmgalaxy\/helloworld-java-ant Duplicate 10 source file from HelloWorld.java Create a directory called &#8220;mybuild&#8221; Clean all 10&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[12],"tags":[420],"class_list":["post-1892","post","type-post","status-publish","format-standard","hentry","category-apache-ant","tag-apache"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=1892"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions"}],"predecessor-version":[{"id":1895,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions\/1895"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}