Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven if-else like behaviour

Tags:

java

maven

I have a multi-module project in maven, where other projects need to use the jars according to the environment.

We have like 4 enviroenments 1.Dev 2.UAT 3.QA 4.PROD

There is a project which wants to use projectname-dev.jar for all three environments (i.e dev,uat,QA ) and projectname-prod.jar for PROD.

I did a google search for something like an if-else logic which I can use in maven profiles.

I can still create a new property for this specific project and change it to '-prod' when it goes into produciton, but thats an extra overhead that I do not want to add.

Are there any plugins I can use for this which will help me get the above work done without adding any kind of manual overhead to it.

Thanks

like image 434
Neeraj Avatar asked Sep 12 '11 14:09

Neeraj


1 Answers

Isn't it what Maven profiles are intended to do? You can define different property values in different profiles and then activate one of them when performing a build.

like image 67
axtavt Avatar answered Oct 14 '22 22:10

axtavt