Eclipse 中的 Maven 配置文件和 Tomcat

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16280858/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:41:14  来源:igfitidea点击:

Maven Profiles and Tomcat in Eclipse

eclipsemaventomcatmaven-3

提问by cahen

If I have 2 maven profiles for a WAR application like this:

如果我有 2 个 WAR 应用程序的 Maven 配置文件,如下所示:

mvn clean install -Pdevelopment
mvn clean install -Pproduction

and I import it in Eclipse to run in Tomcat, how to I tell Tomcat to use one profile or the other?

我在 Eclipse 中导入它以在 Tomcat 中运行,如何告诉 Tomcat 使用一个配置文件或另一个?

回答by Charlee Chitsuk

You can activate the maven profileat the Eclipseby using the following step: -

您可以使用以下步骤激活maven profileat Eclipse: -

  1. Right clickat your project and select properties.
  2. At the Properties windowsselect Maven.
  3. At the right hand panelyou will see Active Maven Profilestext box.
  4. Please enter your profile name, e.g. developmentor production.
  1. Right click在您的项目中并选择properties.
  2. Properties windows选择Maven.
  3. right hand panel您将看到Active Maven Profiles文本框。
  4. 请输入您的profile name,例如developmentproduction

I hope this may help.

我希望这可能会有所帮助。