{"id":1921,"date":"2017-12-06T11:39:11","date_gmt":"2017-12-06T11:39:11","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1921"},"modified":"2020-05-28T07:38:13","modified_gmt":"2020-05-28T07:38:13","slug":"apache-ant-copy-task-full-reference","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/apache-ant-copy-task-full-reference\/","title":{"rendered":"Apache Ant Web References &#038; Cheatsheet"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Apache Ant: Copy Task full reference<\/strong><br \/>\n<b>This copies all files in directories called images that are located in the directory tree defined by ${src} to the destination directory defined by ${dist}, but excludes all *.gif files from the copy.<\/b><\/p>\n<p><code><copy todir=\"${dist}\"><br \/>\n<fileset dir=\"${src}\" includes=\"**\/images\/*\" excludes=\"**\/*.gif\"><br \/>\n<\/fileset><\/copy><\/code><\/p>\n<p><code><b>The same as the example above, but expressed using nested elements.<\/b><\/p>\n<p><copy todir=\"${dist}\"><br \/>\n<fileset dir=\"${src}\"><br \/>\n<include name=\"**\/images\/*\"><br \/>\n<exclude name=\"**\/*.gif\"><br \/>\n<\/exclude><\/include><\/fileset><br \/>\n<\/copy><\/p>\n<p><b>Copy a single file<\/b><br \/>\n<copy file=\"myfile.txt\" tofile=\"mycopy.txt\"><\/copy><\/p>\n<p><b>Copy a single file to a directory<\/b><\/p>\n<p><copy file=\"myfile.txt\" todir=\"..\/some\/other\/dir\"><\/copy><\/p>\n<p><b>Copy a directory to another directory<\/b><\/p>\n<p><copy todir=\"..\/new\/dir\"><br \/>\n<fileset dir=\"src_dir\"><br \/>\n<\/fileset><\/copy><\/p>\n<p><b>Copy a set of files to a directory<\/b><\/p>\n<p><copy todir=\"..\/dest\/dir\"><br \/>\n<fileset dir=\"src_dir\"><br \/>\n<exclude name=\"**\/*.java\"><br \/>\n<\/exclude><\/fileset><br \/>\n<\/copy><\/p>\n<p><copy todir=\"..\/dest\/dir\"><br \/>\n<fileset dir=\"src_dir\" excludes=\"**\/*.java\"><br \/>\n<\/fileset><\/copy><\/p>\n<p><b>Copy a set of files to a directory, replacing @TITLE@ with Foo Bar in all files.<\/b><\/p>\n<p><copy todir=\"..\/backup\/dir\"><br \/>\n<fileset dir=\"src_dir\"><br \/>\n<filterset><br \/>\n<filter token=\"TITLE\" value=\"Foo Bar\"><br \/>\n<\/filter><\/filterset><br \/>\n<\/fileset><\/copy><\/p>\n<p><b>Collect all items from the current CLASSPATH setting into a destination directory, flattening the directory structure.<\/b><br \/>\n<copy todir=\"dest\" flatten=\"true\">\n    <path>\n      <pathelement path=\"${java.class.path}\">\n    <\/pathelement><\/path>\n  <\/copy><\/p>\n<p><b>Copies some resources to a given directory.<\/b><br \/>\n<copy todir=\"dest\" flatten=\"true\"><br \/>\n<resources><br \/>\n<file file=\"src_dir\/file1.txt\"><br \/>\n<url url=\"http:\/\/ant.apache.org\/index.html\"><br \/>\n<\/url><\/file><\/resources><br \/>\n<\/copy><\/p>\n<p><b>Copies the two newest resources into a destination directory.<\/b><br \/>\n<copy todir=\"dest\" flatten=\"true\"><br \/>\n<first count=\"2\"><br \/>\n<sort><br \/>\n<date xmlns=\"antlib:org.apache.tools.ant.types.resources.comparators\"><br \/>\n<resources><br \/>\n<file file=\"src_dir\/file1.txt\"><br \/>\n<file file=\"src_dir\/file2.txt\"><br \/>\n<file file=\"src_dir\/file3.txt\"><br \/>\n<url url=\"http:\/\/ant.apache.org\/index.html\"><br \/>\n<\/url><\/file><\/file><\/file><\/resources><br \/>\n<\/date><\/sort><br \/>\n<\/first><br \/>\n<\/copy><\/p>\n<p><b>copy a set of files<\/b><br \/>\n<copy todir=\"${temp.dir.classes}\"><br \/>\n<fileset dir=\"${src.dir}\"><br \/>\n<include name=\"**\/*.xml\"><br \/>\n<include name=\"**\/*.xsl\"><br \/>\n<include name=\"**\/*.properties\"><br \/>\n<\/include><\/include><\/include><\/fileset><br \/>\n<\/copy><\/p>\n<p><\/code><code><b>Ant copy task examples<\/b><br \/>\n<copy file=\"${resources.dir}\/MANIFEST.MF\" tofile=\"${temp.dir.meta-inf}\/MANIFEST.MF\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/managed-beans.xml\" tofile=\"${temp.dir.web-inf}\/managed-beans.xml\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/navigation-rules.xml\" tofile=\"${temp.dir.web-inf}\/navigation-rules.xml\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/monitoring-managed-beans.xml\" tofile=\"${temp.dir.web-inf}\/monitoring-managed-beans.xml\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/monitoring-navigation-rules.xml\" tofile=\"${temp.dir.web-inf}\/monitoring-navigation-rules.xml\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/faces-config.xml\" tofile=\"${temp.dir.web-inf}\/faces-config.xml\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/log4j.properties\" tofile=\"${temp.dir.classes}\/log4j.properties\" overwrite=\"true\"><br \/>\n<copy file=\"${resources.dir}\/commons-logging.properties\" tofile=\"${temp.dir.classes}\/commons-logging.properties\" overwrite=\"true\"><br \/>\nfileset dir=\"${config.deploy.dir}\"&gt;<br \/>\n<include name=\"**\"><br \/>\n<exclude name=\"apps\/\"><br \/>\n<\/exclude><\/include><\/copy><\/copy><\/copy><\/copy><\/copy><\/copy><\/copy><\/copy><\/code><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: Apache Ant: Copy Task full reference This copies all files in directories called images that are located in the directory tree defined by ${src} to the&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[12],"tags":[420],"class_list":["post-1921","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\/1921","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=1921"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1921\/revisions"}],"predecessor-version":[{"id":7246,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1921\/revisions\/7246"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}