java - Building 2 jars with different source with Maven -


i trying build 2 jars 1 java project. 2 jars have exact same source except @ build time 1 build boolean variable set true , 1 build same boolean variable set false.

example:

jar 1 have same source except in 1 java file have:

public static final boolean enable_toast = true; 

jar 2 have same source except in same java file have:

public static final boolean enable_toast = false; 

i relatively new maven , ant , had idea of using maven-replacer-plugin. however, cannot find has done before.

my approach create 3 properties files:

  1. app.properties
  2. app.properties.test.environment
  3. app.properties.prod.environment

2) , 3) have different settings each environment (i.e. enable_toast = false prod , true test)

the application, of course, uses app.properties

at build time, replace app.properties contents of correct environment (2 or 3)

in ant, have 2 targets each copy file command overwrite flag set true.

i'm sure maven has similar feature (too busy atm)

hope helps


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -