繁体   English   中英

查找参数是使用ant在INI文件中设置的

[英]Finding a parameter is set in an INI file with ant

我有一个配置文件,称为“ config.ini”,并且我有类似以下内容:

somevar1=11111
somevar2=11111
password=
somevar4=11111

如何在Ant中进行操作,以了解是否已为我的构建脚本设置了密码参数设置器?

build.xml文件

<project name="ant-length-of-property" default="run">
    <target name="run">
        <condition property="password.set" else="false">
            <and>
                <isset property="password"/>
                <length string="${password}" when="greater" length="0"/>
            </and>
        </condition>

        <echo>password.set: ${password.set}</echo>
    </target>
</project>

命令输出:ant -Dpassword = myPassw0rd

run:
     [echo] password.set: true

命令输出:ant -Dpassword =

run:
     [echo] password.set: false

您可以使用property任务:

<property file="config.ini"/>

<condition property="password.set" else="false">
  <isset property="passowrd"/>
</condition>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM