建立两个不同的版本给定的战争与maven配置文件和过滤从eclipse [英] Building two different versions a given war with maven profiles and filtering from eclipse

查看:202
本文介绍了建立两个不同的版本给定的战争与maven配置文件和过滤从eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要使用 maven个人资料过滤来生成给定网络存档的两个不同版本 war ):


  1. 第一个用于本地部署到本地机器上的本地计算机

  2. 第二个用于远程部署到cloudfoundry

根据应用程序是否部署到我的本地机器或cloudfoundry,属性有所不同。



当然,难点是我试图做所有这是从STS / Eclipse 并从Eclipse部署到我的本地tomcat和cloudfoundry ...



任何人都可以提供建议,提示或建议?如果你正在使用Spring versioning 3.1+的profile属性< beans>

c $ c>在spring bean配置xml将是最好的选择。请查看此处的文档: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#using-spring-profiles-to-conditionalize-cloud-foundry-configuration



基本上你需要指定至少2个元素。一个用于您的本地属性( profile =default),一个用于部署到CF时的属性。后者应定义为< beans profile =cloud> 。在本地运行时,cloud中的属性将被忽略,并且default中的属性将生效。当推送到CF时,CF将检测名为cloud的配置文件,并且更好地注入由CF自身提供的服务的相应数据源连接信息。您也可以在该文档中找到详细的CF指定的属性。



有关配置文件属性的详细信息,请参阅此处的文档: http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/


I am trying to use maven profiles and filtering in order to produce two different versions of a given web archive (war):

  1. A first one for local deployment to my local machine on localhost
  2. A second one for remote deployment to cloudfoundry

There are a number of properties that differ according to whether the app is deployed to my local machine or to cloudfoundry.

Of course the difficult bit is that I am trying to do all this from STS/Eclipse and deploy from Eclipse to my local tomcat and to cloudfoundry...

Can anyone please provide advice, tips or suggestions?

解决方案

If you are using Spring versioning 3.1+ the "profile" attribute for <beans> in the spring bean configuration xml would be the best choice. Take a look at the doc here: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#using-spring-profiles-to-conditionalize-cloud-foundry-configuration

Basically you need to specify at least 2 elements. One for your local properties (profile="default") and one for the properties when deployed to CF. The latter one should be defined as <beans profile="cloud">. When running locally the properties within "cloud" would be ignored and properties in "default" will take effect. When pushed to CF, CF will detect the profile named "cloud" and, which is better, inject corresponding datasource connection info of the services provisioned by CF itself. You can find the detailed CF-specified properties in that doc as well.

For more information about the profile attribute, see the doc here: http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/

这篇关于建立两个不同的版本给定的战争与maven配置文件和过滤从eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆