MAVEN – Reduce build time in local enviornment

In most of the Java projects, Maven is being used as a build tool. We use “mvn –U install” command to build the project. While building the project, the maven will download the dependent jars (mentioned in POM.xml file) from the project specific repository/maven repository. Once the build is completed, then all the downloaded jars will be stored in local machine(C:/Users/<>/.m2).

Please run .m2 command on the Run window and check it out.

This kind of build process will take more time as it needs to download all the jars. But this is not required all the times. We can use the downloaded local jars available in the local repository for building the project in the next time

To do that we need to pass –o option while building our project. For example, mvn –o install. This will speed up our code build time.