Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant获取在运行时获取的参数的值_Ant - Fatal编程技术网

Ant获取在运行时获取的参数的值

Ant获取在运行时获取的参数的值,ant,Ant,我有一个Ant构建任务,在这个任务中,我需要根据运行时获得的值查找属性文件。例如,我在属性文件中有以下信息 COMPLETE_LIST=TEST1,TEST2,TEST3 TEST1=val1 TEST2=val2 TEST3=val3 在我的Ant目标中,我有以下任务 <target name="target_main"> <foreach param="profile_name" list="${COMPLETE_LIST}" target="target_chi

我有一个Ant构建任务,在这个任务中,我需要根据运行时获得的值查找属性文件。例如,我在属性文件中有以下信息

COMPLETE_LIST=TEST1,TEST2,TEST3
TEST1=val1
TEST2=val2
TEST3=val3
在我的Ant目标中,我有以下任务

<target name="target_main">
    <foreach param="profile_name" list="${COMPLETE_LIST}" target="target_child">
    </foreach>
</target>

<target name="target_child">
<echo>Printing the value of the param passed ${${profile_name}}</echo>
</target>

打印传递的参数值${${profile_name}

但这是行不通的。有没有办法获取作为参数传递的
TEST1
的值?

由于您已经在使用,该任务将帮助您完成所需的操作。以下是根据您的目的修改的
target\u child
的主体:

<target name="target_child">
  <propertycopy name="value" from="${profile_name}"/>
  <echo>Printing the value of the param passed ${${profile_name}}</echo>
</target>

由于您已经在使用,该任务将帮助您完成所需的操作。以下是根据您的目的修改的
target\u child
的主体:

<target name="target_child">
  <propertycopy name="value" from="${profile_name}"/>
  <echo>Printing the value of the param passed ${${profile_name}}</echo>
</target>