22
May

Maven profiles – to manage dependencies

Creating a pom.xml for all your needs sometimes causes un-necessary dependencies downloaded to your project.

Following pom.xml defines Maven profiles, which when invoked, will download only required dependencies (based on project needs):


4.0.0
com.maven.profiles
prfls
0.0.1-SNAPSHOT



com.github.houbb
heaven
0.1.2



com.applitools
eyes-common-java3
3.152.4

Inorder to install profile specific dependencies, we can build the project from command prompt with following syntax:

mvn -Ptest2 clean install <== to install test2 dependencies mvn -Ptest clean install <== to install test dependencies