Ant
Another Neat Tool, that's what it stands for ;)
Since i have more or less chosen for gradle or at least maven the gaps in this document are not likely to be filled soon.
Quick start
Want to get a java project started quickly ? :
This will just compile anything in the source directory, and setting the build directory to . It means you can run it from there if you match the package name :
For instance no package name results in ./File.class, so this will run :
| running | |
|---|---|
If you specify a package like :
| with package prefix | |
|---|---|
it results in the tree : ./some/other/File.class and so this will run :
| with directory | |
|---|---|
Also, this gives you the opportunity to just complete the class for running.
And if you want to know : the includeantruntime is there to get rid of an annoying warning :
| includeantruntime | |
|---|---|
From the apache documentation :
Whether to include the Ant run-time libraries in the classpath; defaults to yes, unless build.sysclasspath is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run.
So, as many advise on the interwebz... just add that option and forget it ever happened.
just a target
| target | |
|---|---|
Very simple one, if you run :
| run | |
|---|---|
You get :
Because the default target is "Analyze" it will do the same as :
| analyse | |
|---|---|
some handy variables :
Would produce something like :
| output | |
|---|---|
build.properties
To keep some settings out of the build.xml file, but still be able to use them, use build.properties :
And simply use them in the ant file after including the file :
| build.xml | |
|---|---|
Analyze:
[echo] Just say hello !
[echo] Apache Ant version is Apache Ant(TM) version 1.9.4 compiled on April 29 2014 - You are at klopt.org
data types
All data types in ant are :
- Description type : Describes a project
- PatternSet : Groups of patterns
- DirSet : Groups of directories
- FileSet : Groups of files
- FileList : Explicit list of files
- FileMapper : Translates filenames
- FilterReader : Custom class that filters out files
- FilterChain : Series of FilterReaders to further filter files
- FilterSet : Groups of filters
- Selectors : Provides more control over file selection
- Class FileSet : A FileSet for class files
- Path-like structures : A data type resembling a file system path
- XMLCatalog : Catalog of public XML resources
pattern set
todo:
file set
File sets represent just that, it can us include and exclude patterns :