Scott Turnquist
Scott Turnquist

Reputation: 155

intellij idea: defined environment variable not recognized in maven pom

I have a java project opened in IntelliJ IDEA version 2018.1

I have defined an environment variable MY_VAR as /some/path/here in File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner -> Environment Variables

In my pom.xml, in the properties secion, I have defined my property as

<myProperty>${env.MY_VAR}/morepath</myProperty>

However, IntelliJ IDEA complains that "Cannot resolve symbol 'env.MY_VAR'"

Upvotes: 4

Views: 4226

Answers (1)

Artem
Artem

Reputation: 2500

The possible two workarounds:

Setting the variable from terminal:

set env MY_VAR /some/path/here

Then restart your IDE.


Another options is to add export MY_VAR=/some/path/here ~/.profile file.
Then restart your computer.

Upvotes: 1

Related Questions