能否在ant命令行输入参数, 在build.xml文件中可以获取这些参数?如:ant compile "A" "B" "D"

解决方案 »

  1.   

    C:\>ant -?
    Unknown argument: -?
    ant [options] [target [target2 [target3] ...]]
    Options:
      -help                  print this message
      -projecthelp           print project help information
      -version               print the version information and exit
      -diagnostics           print information that might be helpful to
                             diagnose or report problems.
      -quiet, -q             be extra quiet
      -verbose, -v           be extra verbose
      -debug                 print debugging information
      -emacs                 produce logging information without adornments
      -logfile <file>        use given file for log
        -l     <file>                ''
      -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
        -file    <file>              ''
        -f       <file>              ''
      -D<property>=<value>   use value for given property
      -propertyfile <name>   load all properties from file with -D
                             properties taking precedence
      -inputhandler <class>  the class which will handle input requests
      -find <file>           search for buildfile towards the root of the
                             filesystem and use it注意其中的:
      -D<property>=<value>   use value for given property
      -propertyfile <name>   load all properties from file with -D
      

  2.   

    ant -Daaa=123 …
    <echo>${aaa}</echo>