Build Tools (Ant, Maven)

  • In this post I’ll discuss why build tools are required and how they really work in top level.
  • For a specific build tool it expects the project to be in specific structure. E.g: web.xml and lib folder should be present only in WEB-INF folder. Then only it’ll be able to build and deploy. Like that each build tool have their own standards of default project structure. Another example is Maven expects pom.xml to be present in the project in the root directory.

Why Ant or Maven scripts are required?

  • So far we discussed that each build tool expects project to be in specific structure then only it can be able to build and deploy. If your project is not in specific structure which the build tool is expecting, then you can write a script (Ant script, Maven script) by giving the paths of required folders in the script, which makes the script to build and deploy the project.
  • Another reason for writing scripts is that, if you want to deploy the project with out manual process, you can write the script and prepare a batch file to do that job.

Sample Ant script:

you can find sample ANT script from below website:

https://docs.spring.io/docs/Spring-MVC-step-by-step/part1.html