Marcin Szymczak Marcin Szymczak - 3 years ago 242
Java Question

How to access linux environment variables from maven pom?

I want to access linux environment variables from pom.xml

I have added

WAS_LOCAL_HOST='http://localhost:9081'
to

~/.bashrc
and
~/.zsh/rc/env.rc


Now I want to access it from maven's
pom.xml
. I have tried
${env.WAS_LOCAL_HOST}
and
${WAS_LOCAL_HOST}
, but my IntelliJ still marks it as
Cannot resolve symbol env.WAS_LOCAL_HOST


How to properly access this variable from maven?

Answer Source

In the pom, refer the environment variable, say MY_VALUE as ${env.MY_VALUE}. Check this link for more information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download