Build a common binary which can run everywhere. If you don't have it written yet, consider using Spring Boot as the Spring configuration system is quite powerful and easy to use with dependency injection.
Create a package for each deployment which puts the binary (and any other files) together with a property file for that deployment. Deploy that.