简体   繁体   English

在tomcat7 maven插件中设置ENV变量

[英]Set ENV variables in tomcat7 maven plugin

Is there a way to set ENV variables through tomcat7-maven-plugin such that they appear in System.getenv() ? 有没有办法通过tomcat7-maven-plugin设置ENV变量,使它们出现在System.getenv()

The system properties can be set using the <systemProperties> that appear in System.getProperties() map. 可以使用System.getProperties()映射中显示的<systemProperties>设置系统属性。 I am looking for a similar way to pass environment variables. 我正在寻找一种传递环境变量的类似方法。

This has been answered here: Setting User Environment Variables for tomcat on Windows 这已在此处得到解答: 在Windows上为tomcat设置用户环境变量

From an admin command prompt do the following command: 从管理命令提示符处执行以下命令:

 tomcat8 //US//YourServiceName ++Environment varname=value 

You can set more than one variable by separating them with a semicolon (;) or a hash (#). 您可以通过用分号(;)或散列(#)分隔多个变量来设置它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM