`
kanpiaoxue
  • 浏览: 1753909 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

eclipse中的tomcat和maven的profile协作

 
阅读更多

 

在使用eclipse、maven、tomcat开发java应用的时候,可能maven中使用到了maven的profile来切换不同的环境(dev 开发、test 测试、prod 线上)。 如果在eclipse中的tomcat启动该项目的时候,如何让maven的profile生效呢?

 

回答:

鼠标右键点击eclipse的project,找到Properties的选项,弹出窗口。在窗口的左侧找到Maven的配置,有一项配置是:Active Maven Profiles(comma separated),在这里填写你指定的maven的profile,然后启动tomcat即可。

 

下面是网上给出的解决方案。

==============================================

问题:

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

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?

 

回答:

Answer:

You can activate the maven profile at the Eclipse by using the following step: -

Right click at your project and select properties .

At the Properties windows select Maven.

At the right hand panel you will see Active Maven Profiles text box.

Please enter your profile name, e.g. development or production.

I hope this may help.

 

参考资料:https://stackoverflow.com/questions/16280858/maven-profiles-and-tomcat-in-eclipse

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics