Apache Jakarta and Beyond: A Java Programmeramp;#039;s Introduction [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Apache Jakarta and Beyond: A Java Programmeramp;#039;s Introduction [Electronic resources] - نسخه متنی

Larne Pekowsky

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







2.7. Command-Line Arguments


By default, when Ant is started from the command line, it will look for a file called build.xml in the current directory, start processing from the default target of the project, and produce output messages in the format seen throughout this chapter. All of these behaviors can be modified by passing Ant appropriate flags when it starts up. Ant takes options in Unix format, with the name of each option prepended by a dash (-) and with spaces between each option and any arguments to that option.

When started with -buildfile, -file, or just -f, followed by the name of the file, Ant will use the specified file instead of build.xml. The file name may be a complete path or relative to the current directory. It is important to note that when the build file is in a directory other than the one from which Ant is run, then all paths in the build file will be relative to the location of the build file. So if a user's current directory is "/home" and that user runs ant -f /projects/sample/samplebuild.xml, then any references to "."such as in the dir attribute of a filesetwill refer to the "/projects/sample" directory.

When started with -find and the name of a file, Ant will look for a build file with the given name in the current directory, then the parent directory, and so on until it finds the file or reaches the root of the file system. In the latter case, Ant will abort with an error message. This option allows many projects or subprojects to use the same build file.

Ant can be made to run a target other than the default by giving the name of the target on the command line. If several target names are provided, Ant will run each in the order it appears on the command line. Target names must appear as the last command line arguments.

It is common for one build file to have separate targets to assemble and compile all the code for a project, test the final project, and package it up for distribution. Often the default task will be the one that runs the compilation because that is what developers spend most of their time doing. Once all the code has compiled to the developers' satisfaction, he or she may run ant.bat test or ant.bat deploy. In addition the deploy target will likely depend on the test target, which in turn will depend on the compile target. The deploy target therefore represents the complete build process, and the other targets provide a handy way to jump in at some intermediate point and run only what is needed.

Properties can also be provided on the command line, using -D followed immediately by the name of the property to set, then an equals sign (=) and the valuefor example, -DTOMCAT_HOME=/usr/local/tomcat. Property values provided in this way are accessed directly by name, without the environment name and dot that accompany environment properties. Ant can ensure that needed command line properties have been provided with the fail task, just as with environment properties.

Ant also accepts additional flags that will not be covered here, a full list can be obtained by running


ant -help


/ 207