{"id":278,"date":"2010-07-22T11:09:52","date_gmt":"2010-07-22T11:09:52","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/07\/22\/how-to-put-comment-in-ant-comments-in-apache-ant\/"},"modified":"2017-12-29T13:18:26","modified_gmt":"2017-12-29T13:18:26","slug":"how-to-put-comment-in-ant-comments-in-apache-ant","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-put-comment-in-ant-comments-in-apache-ant\/","title":{"rendered":"How to put comment in Ant | Comments in Apache Ant"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4418 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/07\/comments-in-apache-ant.png\" alt=\"comments-in-apache-ant\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/07\/comments-in-apache-ant.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/07\/comments-in-apache-ant-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>How to put comment in Ant | Comments in Apache Ant <\/strong><\/p>\n<p><strong>Method 1:<\/strong><\/p>\n<p>&lt;!&#8211; Comments are just as important in buildfiles, do not &#8211;&gt;<br \/>\n&lt;!&#8211; avoid writing them! &#8211;&gt;<br \/>\n&lt;!&#8211; Example build file for &#8220;Ant: The Definitive Guide&#8221; &#8211;&gt;<br \/>\n&lt;!&#8211; and its sample project: irssibot &#8211;&gt;<\/p>\n<p><strong>Method 2: Echo<\/strong><br \/>\n<strong>Description<\/strong><br \/>\nWrites a message to the Ant logging facilities. A message may be supplied<br \/>\nas nested text to this task.<br \/>\nEchoes a message to the current loggers and listeners which means System.out unless overridden. A level can be specified, which controls at what logging level the message is filtered at.<br \/>\nThe task can also echo to a file, in which case the option to append rather than overwrite the file is available, and the level option is ignored<\/p>\n<h3>Parameters<\/h3>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\"><strong>Attribute<\/strong><\/td>\n<td valign=\"top\"><strong>Description<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\"><strong>Required<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">message<\/td>\n<td valign=\"top\">the message to echo.<\/td>\n<td valign=\"top\">\n<p align=\"center\">No. Text may also be included in a character section within this element. If neither is included a blank line will be emitted in the output.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">file<\/td>\n<td valign=\"top\">the file to write the message to.<\/td>\n<td valign=\"top\">\n<p align=\"center\">No<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">append<\/td>\n<td valign=\"top\">Append to an existing file (or <a href=\"http:\/\/java.sun.com\/j2se\/1.4.2\/docs\/api\/java\/io\/FileWriter.html#FileWriter(java.lang.String, boolean)\" target=\"_blank\" rel=\"noopener\">open a new file \/ overwrite an existing file<\/a>)?<\/td>\n<td valign=\"top\">\n<p align=\"center\">No &#8211; default is false.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">level<\/td>\n<td valign=\"top\">Control the level at which this message is reported. One of &#8220;error&#8221;, &#8220;warning&#8221;, &#8220;info&#8221;, &#8220;verbose&#8221;, &#8220;debug&#8221; (decreasing order)<\/td>\n<td valign=\"top\">\n<p align=\"center\">No &#8211; default is &#8220;warning&#8221;.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">encoding<\/td>\n<td valign=\"top\">encoding to use, default is &#8220;&#8221;; the local system encoding. <em>since Ant 1.7<\/em><\/td>\n<td valign=\"top\">\n<p align=\"center\">No<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Examples<\/strong><br \/>\n<strong>Style 1:<\/strong><br \/>\n&lt;echo message=&#8221;Hello, world&#8221;\/&gt;<\/p>\n<p><strong>Style 2:<\/strong><br \/>\n&lt;echo message=&#8221;Embed a line break:${line.separator}&#8221;\/&gt;<\/p>\n<p><strong>Style 3:<\/strong><br \/>\n&lt;echo&gt;Embed another:${line.separator}&lt;\/echo&gt;<\/p>\n<p><strong>Style 4:<\/strong><br \/>\n&lt;echo&gt;This is a longer message stretching over<br \/>\ntwo lines.<br \/>\n&lt;\/echo&gt;<\/p>\n<p><strong>Style 5:<\/strong><br \/>\n&lt;echo&gt;<br \/>\nThis is a longer message stretching over<br \/>\nthree lines; the first line is a blank<br \/>\n&lt;\/echo&gt;<\/p>\n<p><strong>Style 5:<\/strong><br \/>\n&lt;echo message=&#8221;Deleting drive C:&#8221; level=&#8221;debug&#8221;\/&gt;<br \/>\nA message which only appears in -debug mode.<\/p>\n<p><strong>Style 6:<\/strong><br \/>\n&lt;echo level=&#8221;error&#8221;&gt;<br \/>\nImminent failure in the antimatter containment facility.<br \/>\nPlease withdraw to safe location at least 50km away.<br \/>\n&lt;\/echo&gt;<br \/>\nA message which appears even in -quiet mode.<\/p>\n<p><strong>Style 7:<\/strong><br \/>\n&lt;echo file=&#8221;runner.csh&#8221; append=&#8221;false&#8221;&gt;#\\!\/bin\/tcsh<br \/>\njava-1.3.1 -mx1024m ${project.entrypoint} $$*<br \/>\n&lt;\/echo&gt;<br \/>\nGenerate a shell script by echoing to a file. Note the use of a double $ symbol to stop Ant filtering out the single $ during variable expansion<br \/>\nDepending on the loglevel Ant runs, messages are print out or silently ignored:<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\"><strong>Ant-Statement<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\"><strong>-quiet, -q<\/strong><\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\"><strong><em>no statement<\/em><\/strong><\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\"><strong>-verbose, -v<\/strong><\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\"><strong>-debug, -d<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is error message.&#8221; level=&#8221;error&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is warning message.&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is warning message.&#8221; level=&#8221;warning&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is info message.&#8221; level=&#8221;info&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is verbose message.&#8221; level=&#8221;verbose&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><strong>&lt;echo message=&#8221;This is debug message.&#8221; level=&#8221;debug&#8221; \/&gt;<\/strong><\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">not logged<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"center\">ok<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Method 3:<\/strong><br \/>\nDescription<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to put comment in Ant | Comments in Apache Ant Method 1: &lt;!&#8211; Comments are just as important in buildfiles, do not &#8211;&gt; &lt;!&#8211; avoid writing them! &#8211;&gt; &lt;!&#8211;&#8230; <\/p>\n","protected":false},"author":1,"featured_media":4418,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[12],"tags":[209,4238,4239,4242,4243,4235,4237,4236,1122,3113,4241,919,4240,104],"class_list":["post-278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache-ant","tag-ant","tag-ant-comment-block","tag-ant-commenting","tag-ant-comments","tag-ant-multiline-comments","tag-comment","tag-comments-in-ant-build","tag-comments-in-apache-ant","tag-guide","tag-how-to","tag-how-to-put-comment-in-ant","tag-instructions","tag-method","tag-tutorials"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/278","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=278"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"predecessor-version":[{"id":4423,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/278\/revisions\/4423"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4418"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}