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?
In the pom, refer the environment variable, say MY_VALUE
as ${env.MY_VALUE}
. Check this link for more information.
I'm not sure this applies but you could give it a go.
When you add a variable to ~/.bashrc
you just add it as a variable you can use in your shell. If you want to use the variable system wide I'd try to put in /etc/profile
.
On the other hand where to declare these system wide variables sometimes depends on the Linux distribution you use. /etc/profile
is the place the go when you're for example using a Red Hat distribution but when you're using let's say Ubuntu the user guide recommends to declare them in /etc/environment
. you should probably look it up for your distribution.
Also, after declaring them don't forget to log out and in again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With