无法引用环境变量

huangapple go评论74阅读模式
英文:

Unable to reference environment variables

问题

我无法引用下面显示的用户环境变量(红框)的原因,但可以引用系统环境变量(绿框)而没有任何问题吗?

英文:

Anyone know why I am unable to reference the User environment variables shown below (red box) but I am able to reference the System environment variables (green box) without any issues?

无法引用环境变量

答案1

得分: 1

在简短的说,它们需要放置在 POM 中的 <environmentVariables>ENVIRONMENT VARIABLES GO HERE </environmentVariables> 中才能被识别。正如 @Andrey 在他的回答中指出的,它们会显示为未解析,但仍然可以工作。您可以使用以下方式停止它们显示为未解析:<!--suppress UnresolvedMavenProperty -->

英文:

Ok so, in short, they need to be placed in <environmentVariables>ENVIRONMENT VARIABLES GO HERE </environmentVariables> within the POM for them to be picked up. As @Andrey pointed out in his reply, they do show as unresolved but will still work. You can stop them showing as unresolved using: <!--suppress UnresolvedMavenProperty -->

答案2

得分: 0

IDE仅提供了一些预定义的环境变量以供完成和验证。其他变量可能无法解析。为了不报告错误,您可以使用意图操作来抑制它:

无法引用环境变量

还请注意,在IDE中的运行配置中定义时,环境变量仅针对使用该配置启动的此特定会话而定义。

如果您希望在pom.xml文件中获取环境变量,您需要在操作系统中定义它。

英文:

IDE provides only some of the pre-defined environment variables for completion and validation. Other variables may be not resolved. For the error not to be reported you can use intention action to suppress it:

无法引用环境变量

Also note that when defined in Run Configuration in IDE - the environment variables are only defined for this particular session that you launch using this configuration.

If you want for the environment variables to be picked up in pom.xml file you need to define it in the OS.

huangapple
  • 本文由 发表于 2020年8月4日 23:17:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/63249980.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定