Maven if-else as behavior

I have a multi-module project in maven where other projects should use banks in accordance with the environment.

We have 4 types of protection 1.Dev 2.UAT 3.QA 4.PROD

There is a project that 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 if-else logic that I can use in maven profiles.

I can create a new property for this particular project and change it to '-prod' when it goes into production, but this is an additional overhead that I don’t want to add.

Are there any plugins that I can use for this that will help me do the above work without adding any manual overhead.

thanks

+6
source share
2 answers

Doesn't that mean Maven profiles ? You can define different property values ​​in different profiles and then activate one of them during assembly.

+7
source

Not exactly what you are looking for, but you should not create environment-specific artifacts. Contrary to popular belief, this is a terrible abuse of Maven profiles. You have to create one artifact suitable for any environment. An artifact configuration that is external to the artifact is specific to each environment.

0
source

Source: https://habr.com/ru/post/897154/


All Articles