英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论