Why do we need a build tool?

Why we need build tool?

Consider this scenario where you want to run a java application 


  • You can use java compiler (javac) provided by JDK to compile java code into Byte Code which can then run on any Machine
  • To compile Java Programs using javac you will have to list all java source files to run the entire application

Ex., "javac Program1.java Program2.java Program3.java Program4.java"

This is a very tedious job.

Doing this manually is a pain since there are hundreds of libraries used even in the simplest of Java Application


  • Also one has to add Compilation classpath to make the code work. For example if the code uses libraries like testNG, Selenium etc. You need to add it to Compilation Classpath using following code: "javac -cp testNG.jar; webdriver.jar; lib3.jar" MyProgram.java
  • In conclusion, Compiling java code manually becomes very tedious and complex task
  • Enter Third party build tools like Spring boot, apache-commons, Guava, Lime3, Maven, Gradle which makes compilation simple, repeatable, error-free.
  • Build tools also allows developers to easily package your application and publish it easily.


 


Comments

Popular posts from this blog

Jenkins CICD in One Page

Deutsche Bank Interview Questions - 2024