【问题标题】:how to access the .properties file in ant if it is in different location如果它位于不同的位置,如何访问 ant 中的 .properties 文件
【发布时间】:2013-08-13 16:38:57
【问题描述】:
<property file="Build.properties"/> 

如果build.properties 文件位于项目的根目录中,则此选项有效。现在,如果 Build.properties 文件位于 src 文件夹中且 build.xml 位于根目录(主项目根目录)中,那么访问该文件的语法是什么build.properties 文件。

【问题讨论】:

    标签: java ant properties-file


    【解决方案1】:

    这可以通过两种方式来完成

    1. 在类路径中给出位置。

    2. &lt;property file="src/build.properties" /&gt;

    他们都为我工作。

    【讨论】:

      【解决方案2】:

      您可以在启动 ant 脚本时定义属性。 和 使用 ${proj_home}*.properties 访问您的属性文件。 希望能帮助到你。

      【讨论】:

        【解决方案3】:

        其他答案有效。请注意,您可以将属性文件作为 ant 命令行传递

        ant -propertyfile src/build.properties
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2019-10-14
          • 1970-01-01
          • 2010-09-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-08-29
          相关资源
          最近更新 更多