在Eclipse中部署期间使用变量

时间:2023-02-15 07:46:20

I do have some configuration files. Currently these files are completely written manually. But some parts do change from time to time, like version number or current year. In my ant scripts I could define some variables within the config files and replace these variables during my deployment with the current values. But I do use ant for the full automated nightly build. For normal and interactive work with the software, I do use Eclipse directly without any ant target.

我有一些配置文件。目前这些文件是完全手动编写的。但有些部分会不时发生变化,例如版本号或当前年份。在我的ant脚本中,我可以在配置文件中定义一些变量,并在部署期间使用当前值替换这些变量。但我确实使用ant进行全自动夜间构建。对于使用该软件的正常和交互式工作,我确实直接使用Eclipse而没有任何ant目标。

Does anyone know any way how to replace such variables also within Eclipse deployment?

有没有人知道如何在Eclipse部署中替换这些变量?

Of course, I could keep my source-config file with variables and use ant to create the final config file also in the source folder which is deployed and used, so both are checked in. But this is also redundant information and looky like a hack to me!

当然,我可以保存我的source-config文件和变量,并使用ant在源文件夹中创建最终的配置文件,这个文件也被部署和使用,因此两者都被签入。但这也是多余的信息,看起来像一个黑客对我来说!

Because of so many misunderstandings:

由于这么多的误解:

I would like to have a source-config file with e. g. @MY-VAR@ within the text. During deployment, this placeholder is replaced by a variable value known at compile time. This is possible with ant. Can I do something similar with Eclipse?

我想有一个带e的source-config文件。 G。 @ MY-VAR @在文本中。在部署期间,此占位符将替换为编译时已知的变量值。蚂蚁可以做到这一点。我可以用Eclipse做类似的事吗?

2 个解决方案

#1


0  

How do you read the variables? I would go for system wide properties, this will also work on Linux and Windows platforms and can be changed from computer to computer.

你怎么看变量?我会选择系统范围的属性,这也适用于Linux和Windows平台,可以从计算机更改为计算机。

#2


0  

Are you developing in Java ?

你是用Java开发的吗?

Would this be helpful ?
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm

这会有帮助吗? http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm

#1


0  

How do you read the variables? I would go for system wide properties, this will also work on Linux and Windows platforms and can be changed from computer to computer.

你怎么看变量?我会选择系统范围的属性,这也适用于Linux和Windows平台,可以从计算机更改为计算机。

#2


0  

Are you developing in Java ?

你是用Java开发的吗?

Would this be helpful ?
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm

这会有帮助吗? http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm