Ant Building Projects - Apache Ant

What is Ant Building Projects?

Now that we have learnt about the information types in Ant, it's time to place that information into action. we can build a venture on this chapter. The purpose of this chapter is to build an Ant record that compiles the java lessons and places them in the web-INFclasses folder.

Remember the following project structure:

  • The database scripts are saved in the db folder.
  • The java supply code is saved in the src folder.
  • The images, js, META-INF, styles (css) are saved inside the war folder.
  • The JSPs are saved inside the jsp folder.
  • The third party jar files are saved inside the lib folder.
  • The java class files are saved in the web-INFclasses folder.

This project forms the hello world Fax application for the rest of this tutorial.

Here is the build.xml required for this project. let us remember it piece by using piece.

First, let us declare some properties for the source, web, and build folders.

In this example:

  • Src.dir refers to the supply folder of the project wherein the java supply files can be observed.
  • Web.dir refers to the web source folder of the task, in which you may find the JSPs, web.xml, css, javascript and other net related files
  • Build.dir refers to the output folder of the task compilation.

Properties can talk to other properties. As proven inside the above example, the build.dir assets makes a reference to the web.dir property.

In this case, the src.dir refers to the supply folder of the project.

The default goal of our task is the complet target. but first allow us to examine the clean target.

The clean target, because the name shows, deletes the files inside the build folder.

The master-classpath holds the classpath data. In this situation, it includes the lessons inside the build folder and the jar files within the lib folder.

Finally, the build target to build the documents. to begin with, we create the construct listing, if it does not exist. Then we execute the javac command (specifying jdk1.5 as our target compilation). We supply the source folder and the classpath to the javac project and ask it to drop the class files within the build folder.

Executing Ant on this record compiles the java source documents and locations the classes within the build folder.

The following outcome is the result of running the Ant file:


The files are compiled and placed in the build.dir folder.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Ant Topics