

In this case ant first executes t2 and then t1 because of the dependency.Ĭommonly used attributes of target elements:ī. What I wantwith this is to create a common folder where all projects copy their distributable files in it, and that folder is never cleaned, the files in there should be only replaced.
#Apache ant build jar code#
If a target depends on other one or more targets then ant will automatically executes the dependent targets.Įxample: If a target t1 depends on target t2 and ant instructed to executed t1. So, what code should I insert here, so Ant after finishing the compilation then copy the compiled (myfile.jar) to another folder (./myfolder/). A target can be dependent on other target.

Target:Ī target is used to group the tasks and can be run directly via ant. path: It creates a classpath container which can be used later. mkdir: It creates the specified directory structure.ġ1. sql: It executes the specified sql statements.ġ0. javadoc: It generates the code documentation.ĩ. echo: It prints the text to the System.out or to a file.Ĩ. junit: It runs the junit test cases from the junit framework.ħ. javac: It compiles the specified source code.Ħ. : It specifies the java version which is used by ant. : It specifies the ant jar file location.ħ. ant.home: It specifies the home directory of apache ant installation.Ħ. : It specifies the name of the project.ĥ. basedir: It specifies the base directory of the build.Ĥ. ant.version: It specifies the installed ant version.ģ. ant.file: It specifies the build file location.Ģ. The value of the property can be accessed using $.ġ. A property can be read from a file or a classpath resource using file and resource attributes respectively. Property element is used to define the properties like project name, project source directory etc. basedir: It specifies the base directory of the project. default: It specifies the default target for the build script.Ĭ. name: It specifies the name of the project.ī. A project element has the following attributes:Ī. It is the root element of the build.xml file. Commonly used elements of ant build file: 1.
