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

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

问题描述

我正在尝试使用 maven个人资料过滤,以便生成给定网络档案( war)的两个不同版本

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


  1. 第一个本地部署到本地机器本地机器

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

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

有一个数字的属性根据应用程序是否部署到本地机器或cloudfoundry而有所不同。

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

当然,困难的是,我正在努力做所有这是从STS / Eclipse ,并从Eclipse部署到我的本地tomcat和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...

任何人都可以提供建议,提示或建议? p>

Can anyone please provide advice, tips or suggestions?

推荐答案

如果您使用Spring版本3.1+,< beans> 在spring bean中配置xml将是最好的ch音色。在这里查看文档: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#using-spring-profiles-to-conditionalize-cloud-foundry-configuration

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

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

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.

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

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天全站免登陆