Apache Ant
is a software tool for automating software build processes. It is
similar to Make but is implemented using the Java language, requires the
Java platform, and is best suited to building Java projects.
The most immediately noticeable difference between Ant and Make is that
Ant uses XML to describe the build process and its dependencies,
whereas Make uses Makefile format.
By default the XML file is named
build.xml
.There is much more to building software than just typing in and then compiling the source code. There is a number of steps required to transform the source into a deployable and useable software solution.
The following is a
hypothetical build process you might use with a simple software
system
- Get the source. You may need to download or fetch the source from a source code repository. For this, you might need to know the tag or version of the source code you want to build.
- Prepare a build area. You will probably want to create a set of directories, perhaps according to some standardized directory layout.
- Configure the build. In this step, you will determine what optional components can be built based on the current environment. You might want to set build numbers and version numbers to be included in the build.
- Validate the source code. You may have a standard style guide and you wish to ensure all code conforms to this before you build a release.
- Compile the source code
- Build the compiled code into libraries potentially including non-code resources such as properties, images and sound files.
- Run the system's tests to validate the build.
- Build the documentation for the software. This may range from something as simple as collecting text files up to processing content through some form of publishing system to produce the documentation in its final form
- Package up all of the components of the software – code, resources, images, documentation, etc. – into a deployable package. You might need to produce several packages in different formats for different target users
- Deploy the software to some standard location for use or distribution
This is a high-level
view of a software build process. A real-life build process may of
course require many more and varied steps. Each of these steps may
involve many individual operations.
-------------------
Why do we need Maven or Ant, if we already have Eclipse?
- Because your collegue might prefer NetBeans or IDEA
- Because the settings might vary from one eclipse install to another
- Because you might want to get your dependencies automatically
- Because you want to automate the complete build: build, jar, apply static code analysis, run the unit tests, generate the documentation, copy to some directory, tune some properties depending on the environment, etc.
- Because once it's automated, you can use a continuous integration system which builds the application at each change or every hour to make sure everything still builds and the tests still pass...
Eclipse is a development environment. But it's not a build tool
-------------------
CVS, Subversion, Synergy, Perforce, ClearCase and many more Ant can compile source code
Ant can run unit tests
JUnit3, JUnit4, TestNG, or any arbitrary test application
Ant can package compiled code and resources
jars, wars, ears, tars, zips, whatever
-------------------
sources: http://www.exubero.com/ant/antintro-s5.htmlhttp://en.wikipedia.org/wiki/Apache_Ant
http://codefeed.com/tutorial/ant_intro.html
http://stackoverflow.com/questions/10764576/why-do-we-need-maven-or-ant-if-we-already-have-eclipse
No comments:
Post a Comment