Maven in Intellij IDEA cannot resolve symbol env.HOSTNAME

5.9k views Asked by At

I searched all over for a resolution to this problem, but could not find anything specific to my setup. Finally, one of our sys admins figured it out.

I am running Intellij IDEA on Ubuntu 11.10. My Maven pom.xml file was unable to resolve a symbol, a system property environmental variable env.HOSTNAME.

2

There are 2 answers

1
Tomasz Nurkiewicz On

Copy from user1141627 answers' edit:


It turns out that we had to manually set this variable from the terminal so Java would recognize it. The command was:

set env HOSTNAME yourhostname

After restarting Intellij, env.HOSTNAME resolved just fine. To get yourhostname, you can use the command:

hostname

or

echo $HOSTNAME

I realize this is not a question, it is an answer. Hopefully someone finds it useful if they come across a similar problem.

0
John Klit Simonsen On

I know this is an old question, but my answer might help somebody.

Add export HOSTNAME=myhost to your ~/.profile file, and reboot your computer.