<? XML version = "1.0"?>
<Project name = "access" default = "show" basedir = ".">
<Buildnumber/>
<Target name = "show">
<Echo message = "$ {build. Number}"/>
<Tar destfile = "commandid build.number#.tar.bz2" compression = "Bzip2">
<Fileset dir = ".">
<Include name = "*. xml"/>
</Fileset>
</Tar>
<Untar src = "commandid build.number#.tar.bz2" compression = "Bzip2" DEST = "DEST"/>
</Target>
</Project>
Buildnumber: ant adds the value and writes it to a build. number (under basedir ). of course, you can also use the File Attribute to specify a file. as follows:
<Buildnumber file = "My. properties"/>
If the build. number value cannot be found in the specified (or default) file by ANT during runtime, it will generate the value again and increase from 0.
Tar is a packaging command on Linux. in Linux, File compression commands such as ZIP, Gzip, and Bzip2 can only be used for separate files. You cannot compress files or multiple files. to make multiple files form a whole, you need to use the tar command. tar connects multiple scattered files into a whole, but by default, it does not compress these scattered files. That is to say, the tar command is generated to form an overall file (a real packaging command), and then used for File compression commands such as gzip and Bzip2. In the subsequent development of tar, for convenience, tar has some attribute options for File compression. Ant's tar command imitates the tar command on Linux. You can add a compression attribute to compress the file. The specific package and package are as follows.