1

I added this maven job.

exec:java -Dexec.mainClass="com.someclass.SomeClass" -DAPP_HOME="${DEV_ENV_LOC}"

What happens is, spring context is able to pickup the value of APP_HOME, but the java class System.getEnv("APP_HOME"), is not able to pick up the value.

Any ideas?

javapadawan
  • 787
  • 4
  • 10
  • 26

1 Answers1

0

For command line options you have to use System.getProperty():

String appHome = System.getProperty("APP_HOME");

Or pass APP_HOME variable as an environment variable with EnvInject Plugin and lookup it with System.getenv():

String appHome = System.getenv("APP_HOME");

Find more details in difference here.

Community
  • 1
  • 1
Vitalii Elenhaupt
  • 6,666
  • 3
  • 23
  • 39