{"id":148,"date":"2009-10-06T11:36:10","date_gmt":"2009-10-06T11:36:10","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2009\/10\/06\/ant-command-line-arguments-2\/"},"modified":"2017-12-26T07:00:26","modified_gmt":"2017-12-26T07:00:26","slug":"ant-command-line-arguments-2","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/ant-command-line-arguments-2\/","title":{"rendered":"Understand Ant command line arguments with Examples"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4073 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2009\/10\/ant-command-line-arguments.png\" alt=\"ant-command-line-arguments\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2009\/10\/ant-command-line-arguments.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2009\/10\/ant-command-line-arguments-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Several tasks take arguments that will be passed to another process on the command line. To make it easier to specify arguments that contain space characters, nested arg elements can be used.<\/strong><\/p>\n<p><strong>value<\/strong> &#8211; a single command-line argument; can contain space characters.<\/p>\n<p><strong>file <\/strong>&#8211; The name of a file as a single command-line argument; will be replaced with the absolute filename of the file.<\/p>\n<p><strong>path<\/strong> &#8211; A string that will be treated as a path-like string as a single command-line argument; you can use ; or : as path separators and Ant will convert it to the platform&#8217;s local conventions.<\/p>\n<p><strong>pathref<\/strong> &#8211; Reference to a path defined elsewhere. Ant will convert it to the platform&#8217;s local conventions.<\/p>\n<p><strong>line<\/strong> &#8211; a space-delimited list of command-line arguments.<\/p>\n<p>It is highly recommended to avoid the line version when possible. Ant will try to split the command line in a way similar to what a (Unix) shell would do, but may create something that is very different from what you expect under some circumstances.<\/p>\n<p><strong>Examples<\/strong><\/p>\n<p>&lt;arg value=&#8221;-l -a&#8221;\/&gt;<\/p>\n<p>is a single command-line argument containing a space character.<\/p>\n<p>&lt;arg line=&#8221;-l -a&#8221;\/&gt;<\/p>\n<p>represents two separate command-line arguments.<\/p>\n<p>&lt;arg path=&#8221;\/dir;\/dir2:\\dir3&#8243;\/&gt;<\/p>\n<p>is a single command-line argument with the value \\dir;\\dir2;\\dir3 on DOS-based systems and \/dir:\/dir2:\/dir3 on Unix-like systems.<\/p>\n<p>Command-line Options Summary<br \/>\nant [options] [target [target2 [target3] &#8230;]]<\/p>\n<table style=\"border-collapse: collapse; width: 310pt;\" border=\"2\" width=\"414\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col style=\"width: 74pt;\" width=\"99\" \/>\n<col style=\"width: 236pt;\" width=\"315\" \/><\/colgroup>\n<tbody>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl65\" style=\"height: 15.75pt; width: 74pt;\" width=\"99\" height=\"21\"><strong>Options:<\/strong><\/td>\n<td class=\"xl66\" style=\"border-left: medium none; width: 236pt;\" width=\"315\"><\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-help, -h<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Displays help information describing the Ant command and its options<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-projecthelp, -p<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Print project help information<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-version<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Print the version information and exit<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-diagnostics<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Print information that might be helpful to diagnose or report problems.<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-quiet, -q<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Suppresses most messages not originated by an echo task in the buildfile<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-verbose, -v<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Displays detailed messages for every operation during a build.<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-debug, -d<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Print debugging information<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-emacs, -e<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Produce logging information without adornments<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-lib &lt;path&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Specifies a path to search for jars and classes<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-logfile &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Use given file for log<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-l &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Use given file for log<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-logger &lt;classname&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Specifies a class to handle Ant logging.<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-listener &lt;classname&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Add an instance of class as a project listener<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-noinput<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Do not allow interactive input<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-buildfile &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Use given buildfile<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-file &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Use given buildfile<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-f &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Use given buildfile<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-D&lt;property&gt;=&lt;value&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Defines a property name-value pair on the command line.<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-keep-going, -k<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">execute all targets that do not depend on failed target(s)<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-propertyfile &lt;name&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">load all properties from file with -D properties taking precedence<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-inputhandler &lt;class&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">the class which will handle input requests<\/td>\n<\/tr>\n<tr style=\"height: 15.75pt;\">\n<td class=\"xl67\" style=\"border-top: medium none; height: 15.75pt; padding-bottom: 0in; padding-top: 0in;\" height=\"21\">-find &lt;file&gt;<\/td>\n<td class=\"xl67\" style=\"border-top: medium none; border-left: medium none; padding-bottom: 0in; padding-top: 0in;\">Search for buildfile towards the root of the filesystem and use it<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Several tasks take arguments that will be passed to another process on the command line. To make it easier to specify arguments that contain space characters, nested arg elements can&#8230; <\/p>\n","protected":false},"author":1,"featured_media":4073,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[12],"tags":[209,3053,3055,3052,824,3057,3054,632,1122,3056,938,3058,213,2579],"class_list":["post-148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache-ant","tag-ant","tag-ant-command-line-arguments","tag-ant-command-line-arguments-examples","tag-arguments","tag-command-line","tag-command-line-arguments-in-ant","tag-command-line-argument","tag-examples","tag-guide","tag-how-to-pass-ant-command-line-arguments","tag-reference","tag-resource","tag-tutorial","tag-understand"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/148","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=148"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":4075,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions\/4075"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4073"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}