How to use Ant?

I tried to understand what Ant is used for, but I still do not understand.

Can someone give me one use case for which Ant is used, I can try to understand why Ant is useful and what I can use it for?

I'm developing Java in Eclipse, and I'm just starting out with servlets and the Google Web Toolkit.

+5
source share
4 answers

Ant is a building tool. Say, for example, you have several projects in the Eclipse workspace, all of which are parts of a larger application. To collect all this into a jar file with dependencies included, you can select all projects and export them as a jar file, but this is somewhat cumbersome.

Ant is an extensible solution. You define the build process in XML, and ant compiles your java files according to this recipe.

Ant can do more than build. I worked for a company where the deployment engine was a Debian package in our own repository. We had ant scripts that collected jar files, organized them and some metadata files into a Debian package, put them in the repository, and regenerated the repository manifest.

Java, , Ant, , .

+17

Ant , , .

, javac , Ant script, , Ant, javac .

Ant :

  • javac
  • javac
  • cobertura ( )
  • jar cobertura
  • jar unit test
  • checkstyle, pmd, findbugs , .
  • cobertura, .

, 8 , , , "ant".

+4

Ant make XML.

, Ant, , IDE, Eclipse.

, . , - . CC Ant build.xml.

+2

ANT .

, , gnumake, nmake, jam ? , ANT . - shell-based: , , . , , , ; , , Unix, .

Makefiles . , . " tab?!!", ANT . , Jam , .

Ant . , ANT Java . , XML, . , .

Granted, this removes some of the expressive power inherent in the ability to build a shell command, for example find . -name foo -exec rm {}, but it gives you the ability to be cross-platform — work anywhere and everywhere. And hey, if you really need to execute a shell, the ANT command has a task that allows various commands to be executed based on the OS running on.

0
source

All Articles