Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Properties for dev and production

I have a GlassFish/j2ee application, and I develop on one box, and production is a remote box. I have a function that makes files, and I need the files' location to be different based on my dev box or production. What is an automatic way to do the switching so I do not have to edit the source file based on where it is being deployed?

like image 447
bmw0128 Avatar asked Feb 19 '26 08:02

bmw0128


1 Answers

You can use a properties file and externalize environment specific stuff (like your "file location") in this configuration file. Put the adequate value in it at build time (e.g. using filtering and profiles with Maven). Include this file in the application or make it available somewhere on the classpath.

like image 72
Pascal Thivent Avatar answered Feb 20 '26 20:02

Pascal Thivent