Ant task vs Shell script

I see many places in my office where ant tasks are used to move files from one place to another, and also perform some tasks on these files. However, all this can be done with shell scripts .

My question is:

When is ant preferable to shell scripts ?

What are the advantages of using ant over shell scripts to perform the same set of tasks.

One of the advantages of ant is that it works on all platforms, except that there are any performance benefits?

+2
performance shell ant
source share
2 answers

The question is why ANT should be preferred so that shell scripts are doubled:

  • ANT is a tool that is widespread and probably already installed on the developer's workstation. Compared to one of its main predecessors, make, ANT is much more standardized and cross-platform.
  • ANT is a tool familiar to developers. They are used to create their code, so they often extend the ANT script to deploy their application as Well. In fact, many vendors offer ANT tasks for this.

There are actually no performance benefits. Java is slow to use on the command line.

But ..... I would advise against playing "performance". Suppose your application does not support windows (which is strange, considering that a Java application must support all formats ...): I saw that deployment with a shell script is divided into chaos, trying to coordinate different ways of working different commands of the UNIX operating system. Commands such as "tar", "awk", etc., may be slightly different, which leads to additional platform support logic in your script.

In conclusion, I would not use either one or the other. I am choosing a groovy hybrid approach for common scenarios. It is a Java scripting language and includes all the features of ANT. Being a Java-based scripting language, it will work on all platforms. In the interest of justice, it should also be noted that other language options exist. Ruby is certainly worth mentioning as it has spawned a set of configuration management technologies that are worth evaluating. (See Chef and Puppet )

+2
source share

In practice, it comes down to Windows support. If you are in the Unix store and do not want to introduce new materials for developers, there are two alternatives that I have used successfully:

  • Plain old shell script with Git Bash. Git Bash comes with a Git distribution ( http://git-scm.com/ ). If you are doing automation, you can run shell scripts as follows: "C: \ Program Files (x86) \ Git \ bin \ sh.exe" --login -i -./BUILD

  • Node script. Again this is one simple installer, this is javascript, and you can use something like ShellJS ( https://github.com/arturadib/shelljs ) to get closer to the Unix shell script / Makefiles.

0
source share