我怎样才能让一个Ant属性文件来覆盖在另一组的价值? [英] How can I allow an Ant property file to override the value set in another?

查看:132
本文介绍了我怎样才能让一个Ant属性文件来覆盖在另一组的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一只蚂蚁文件执行以下操作:

I have an ant file that does the following:

<property file="project.properties" description="Project configuration properties"/>
<property file="build-defaults.properties" description="default build configuration."/>
<property file="build.properties" description="local build configuration overrides"/>

我想在build-defaults.properties(这是在给SCM选中)设置默认值,但允许开发人员覆盖本地build.properties价值观,使他们能够在本地路径工作。

I want to have defaults set in build-defaults.properties (which is checked in to SCM) but allow developers to override values in a local build.properties so that they can work with local paths.

问题是,它似乎并不奏效;我已经对此进行设置,创建了build.properties的覆盖,但我的路径值保持一个在build-defaults.properties设置。我如何做到这一点?

The problem is, it doesn't seem to be working; I've set this up, created an override in build.properties, but the value of my path remains the one set in build-defaults.properties. How do I accomplish this?

推荐答案

你设置初始的问题是,你有 build.properties build-defaults.properties 逆转。

The initial problem with your set up is that you've got build.properties and build-defaults.properties reversed.

Ant属性不能被覆盖。这就是为什么通过 -Dproperty = value来在命令行上设置任何财产会覆盖你的文件中设置的任何东西;该属性设置,然后没有任何东西可以替代它。

Ant Properties are set once and then can never be overridden. That's why setting any property on the command line via a -Dproperty=value will always override anything you've set in the file; the property is set and then nothing can override it.

所以,你要这个设置方式是:

So the way you want this set up is:

<property file="build.properties" description="local build configuration overrides"/>
<property file="project.properties" description="Project configuration properties"/>
<property file="build-defaults.properties" description="default build configuration."/>

这方式:


  1. 设置任何在命令行接管build.properties precedence

  2. 在任何设置build.properties忽略其他值

  3. 等。下来就行了。

这篇关于我怎样才能让一个Ant属性文件来覆盖在另一组的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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