Tacitus86
Tacitus86

Reputation: 1404

Java Switch using Maven Profile Selection

Is there a way to grab a project's maven profile that was used to compile it to use as an argument in the code as part of an if/else or switch conditional in java code?

IE:

switch(profileName){ 

"profile1": do this
"profile2": do that
 default: something else
}

etc?

Upvotes: 0

Views: 147

Answers (1)

fmatar
fmatar

Reputation: 3470

That's beyond Maven's capabilities. An alternative would be to define multiple profiles that will define your plugins and lifecycles.

Alternatively if you want to go the scripting route and be able to handle dynamic data in your build system then you could use Gradle

Upvotes: 1

Related Questions