ANT property三种使用方式

方式一:引入*.properties文件

1.在cms.properties文件中定义属性

userName=admin

2.在build.xml中引入属性

<property file="${basedir}/build/cms.properties"></property>

3.使用*.properties文件中的属性

<echo message="userName:${userName}"/>

方式二:build文件定义

1.定义properties

<property name="email" value="788999@qq.com"></property>

2.使用properties

<echo message="email:${email}"/>

方式三:ant执行参数传递

1.执行时传入参数

D:projectscmsuild>ant -Dmobile=18300506123

参数名称:mobile     参数值:18300506123

2.使用properties

<echo message="mobile:${mobile}"/>


具体演示:

1.定义属性文件*.properties


2.编写build.xml


3.执行ant



原文地址:https://www.cnblogs.com/pengyan5945/p/5218308.html