This is a really open-ended question, but many here like a challenge.
To be a bit more precise, can you create a github project/repo that demonstrates what you’d like to do, where the config would be held, what parts would be changed by reading it?
Chances are, it’s easier to control both your Java code and the conditional work, and you may find yourself defining all possible targets, but conditionally selecting one as a dependency to get one of a few possible conditionals compiled.
Please share a repo showing the problem, and let us suggest a fix? Mark it up with comments or however to describe what’s not quite what you need.
Allan