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 taskdef中的属性文件_Ant_Properties_Properties File_Taskdef - Fatal编程技术网

读取ant taskdef中的属性文件

读取ant taskdef中的属性文件,ant,properties,properties-file,taskdef,Ant,Properties,Properties File,Taskdef,我正在定义build.xml文件,需要从属性文件中读取一些路径。在我确定的目标上,从中阅读是可以的。当我尝试读取taskdef中的值时,问题就出现了。我怎样才能做到这一点 我有这样的想法: <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"> <classpath> <fileset dir="${paths.jaxb.lib}" includes="*.jar" /> &

我正在定义build.xml文件,需要从属性文件中读取一些路径。在我确定的目标上,从中阅读是可以的。当我尝试读取taskdef中的值时,问题就出现了。我怎样才能做到这一点

我有这样的想法:

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
   <classpath>
      <fileset dir="${paths.jaxb.lib}" includes="*.jar" />
   </classpath>
</taskdef>

My path.jaxb.lib是指向jaxb lib文件夹的路径。如何从paths.properties文件中获取此值?

在执行任务之前阅读属性文件

如果paths.properties为

…然后在build.xml中

paths.jaxb.lib=path/to/my/jaxb/lib
<!-- Loading the Java properties file sets the paths.jaxb.lib Ant property. -->
<property file="paths.properties"/>

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
  <classpath>
    <fileset dir="${paths.jaxb.lib}" includes="*.jar" />
  </classpath>
</taskdef>