Benefits of Maven:
1. Maven Provides the hierarchical Structure of the project, if your all the child projects has some dependency then add that dependency to the parent pom.xml. no need to add the dependency on all the child projects. it will prevent the duplication of dependency.
2. Better dependency management: All the maven projects have pom.xml file where we are defining the dependency artifact and group id. if you have dependency on some library (eg. lib1) and (lib1) has some dependency on some library (eg. lib2) then in you need to add only lib1 dependency on your pom.xml, maven will add automatically lib2 in your project class path.
3. Better code repository Management: In maven projects the code repository is completely isolated from dependency repository, maven has the central repository for all the libraries and jar files. when we are committing our project code to source repository only our source code and configuration will be committed to source repository so source repository will be lightweight. when we checkout the code and build the code then maven will download all the dependency jar files from maven central repository and build the project.
4. Predefined build life-cycles: if you see the Ant build there is no predefined build life cycle targets we are creating the targets and call it. but in maven there is some predefined life cycle targets like (clean, test, package, install etc…)
5. Predefined project structure: Most of the maven projects has the similar folder structure of the project, so if are working on some different technology no need to worry about the project structure if you are using maven build. the build package (jar, war, ear etc…) will be created always in target folder. on top of that if you are using some extra plugin for maven build then the package creation will act based on the plugin.
6. Using another tool is easy: As compared different build tools using of another tool is easy, only you need to add the required maven plugin for that tool. for example you you want to generate sonar report then only you need to ad the sonar plugin to your parent pom.xml and configure that it will be applied to all the child project.
7. Better version Management of your project.
Drawback of Maven:
1. The life-cycle of maven build is not clear from pom.xml
2. If some jar is missing from maven repository it is hard to find the dependency and add to the central repository.
3. It is advisable that to create the own maven central repository, because if some versions is deprecated from maven central repository it will be a problem if the jar is not found.
The post Benefits and Drawback of maven build appeared first on CodingLoading.