Examples
G Brown edited this page Feb 28, 2016
·
18 revisions
ant [options] [target [target2 [target3] ...]]
Options:
-help print this message
-projecthelp print project help information
-version print the version information and exit
-quiet be extra quiet
-verbose be extra verbose
-debug print debugging information
-emacs produce logging information without adornments
-logfile <file> use given file for log
-logger <classname> the class which is to perform logging
-listener <classname> add an instance of class as a project listener
-buildfile <file> use given buildfile
-D<property>=<value> use value for given property
-find <file> search for buildfile towards the root of the
filesystem and use it
CmdLine.defineCommand("-help, #print this message")
.defineCommand("-projectHelp, #print project help information")
.defineCommand("-version, #print the version information and exit")
.defineCommand("-quiet, #be extra quiet")
.defineCommand("-verbose, #be extra verbose")
.defineCommand("-debug, #print debugging information")
.defineCommand("-emacs, #produce logging information without adornments")
.defineCommand("-logfile, !logFile, #use given file for log")
.defineCommand("-logger, !logClass, #the class which is to perform logging")
.defineCommand("-listener, !listenerClass, #add an instance of class as a project listener")
.defineCommand("-buildfile, !buildFile, #use given buildfile")
.defineCommand("-find, !buildFile, #search for buildfile towards the root of the filesystem and use it");
Note: The format of "-D<property>=<value>" is automatically supported and doesnt need to be defined.
If a -D<property>=<value> is seen on the command line, it is parsed and set
in the System properties. In addition, a command is created and sent to the listener.
CmdLine.parse( args, listener );
c:\> myapp --install file0.txt
CmdLine.setCommandListener(listener);
CmdLine.defineCommand("-i, --install, !installFileName, :file[0-9].txt, #install something");
CmdLine.parse( args );
c:\> myapp -install=file1.txt
CmdLine.defineCommand("-install, !installFileName, :file[0-9].txt, #install something")
.setCommandListener(listener)
.parse( args );
myapp -classpath=c:/myapps
CmdLine.defineCommand("-classpath, !classpath, :c:/\\w+, #define the class path")
.parse( args, listener );
c:\> myapp implicit=class
CmdLine.defineCommand("implicit, !implicit, :class|interface|none, #imark a class, interface or none as implicit.")
.parse( args, listener );
c:\> myapp --file=myfilename.txt
CmdLine.defineCommand("--file, !fileName, :\\w+.txt, #the file name to load.")
.parse( args, listener );
c:\> myapp f myfilename.txt
c:\> myapp file myfilename.txt
c:\> myapp filename myfilename.txt
CmdLine.defineCommand("f, file, filename, !fileName, :\\w+.txt, #the file name to load.")
.parse( args, listener );