最好的办法来改变Java构建过程中的常数 [英] Best way to alter constants in Java build process

查看:118
本文介绍了最好的办法来改变Java构建过程中的常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承表示Tomcat下运行的Java应用程序(servlet的)。由于历史的原因,code有不同的外观和感觉的基础上,其中将应用程序部署(主要品牌的问题)的选项。

I have inherited a Java application (servlets) that runs under Tomcat. For historical reasons, the code has different "look and feel" options based on where the application will be deployed (essentially a matter of branding).

有几个常数控制此品牌的过程,其中有不同的功能,不应该被压缩成一个单一的恒定(即品牌,多语文,加的图标和CSS样式表的位置,等)。

There are several constants that control this branding process, which have different functions and should not be compacted into a single constant (i.e. BRAND, MULTI-LANGUAGE, plus the locations of icons and css style sheets, etc.).

目前,开发团队必须手动更改常数(他们至少在一个数据类本地化,有据可查),然后用ANT重新编译应用程序。

Currently the development team must manually change the constants (they are at least localized in one data class and well documented), then recompile the application using ANT.

什么是自动完成这一过程假设最好的办法至少蚂蚁1.8和Java 6.x的?

What is the best way to automate this process assuming at least Ant 1.8 and Java 6.x?

我知道,有没有被使用的编译器参数(像人们可以用C或C ++做)什么好的解决办法,却靠在一些最好的办法,来编辑含有常量的源文件,或将它们放入另一个文件,并使用Ant构建过程中交换出来。我想有一个结果,将工作使用像蚂蚁打造品牌-X,其中改变品牌将改变产生的构建。

I know that there have not been any good solutions using compiler arguments (like one could do in C or C++), and am leaning to some "best way" to edit either the source file containing the constants, or putting them into another file and swapping them out using the ant build process. I'd like to have a result that would work using something like "ant build brand-x" where changing the brand would change the resulting build.

谢谢,

- 理查德

推荐答案

使用替换任务Ant来改变值。

Use the replace task in Ant to change the values.

  • Ant Replace

这篇关于最好的办法来改变Java构建过程中的常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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