Ant构建脚本没有看到refid
我有一个build.xml文件,其中包含一个定义一些refid值的common.xml文件。但是,我的任务无法看到refid值。我一直无法在网上找到解决方案,正在寻求帮助 我在build.xml文件中调用genbeans目标。它在xmlbean任务定义上失败,消息引用my_classpath_jars未找到 build.xmlAnt构建脚本没有看到refid,ant,build,reference,Ant,Build,Reference,我有一个build.xml文件,其中包含一个定义一些refid值的common.xml文件。但是,我的任务无法看到refid值。我一直无法在网上找到解决方案,正在寻求帮助 我在build.xml文件中调用genbeans目标。它在xmlbean任务定义上失败,消息引用my_classpath_jars未找到 build.xml ---------------------------- [includes common.xml] **my_classpath_jars fails to be
----------------------------
[includes common.xml]
**my_classpath_jars fails to be seen at this point - defined in common.xml**
<taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean">
<classpath refid="my_classpath_jars"/>
</taskdef>
<!-- Generate the XMLBeans java code from our source XSD file(s) -->
<target name="genbeans" description="Generate XML Bean files" depends="build_my_jar_cpath">
<mkdir dir="${lib}"/>
<xmlbean destfile="${lib}/${appname}Beans.jar" failonerror="true">
<classpath refid="my_classpath_jars"/>
<fileset dir="src/XSD Files" includes="*.xsd, *.wsdl"/>
</xmlbean>
</target>
common.xml
-----------------------------
<target name="build_my_jar_cpath">
<path id="my_classpath_jars">
<fileset dir="${jardir}" includes="**/*.jar" />
</path>
<pathconvert pathsep="${path.separator}" property="myjar.clpath" refid="my_classpath_jars"/>
</target>
----------------------------
[包括common.xml]
**此时无法看到my_classpath_jars-在common.xml中定义**
common.xml
-----------------------------
如果有疑问,请在呼叫目标时使用ant-d
开关。您将看到大量的输出。将其保存到一个文件中并对其进行解析
这样做,您会在输出中注意到的第一件事是,它在定义taskdef
之前定义了my\u classpath\u jars
。只有当您调用greenbeans
target时,才会设置my\u classpath\u jars
refid。您的
在调用任何目标之前执行
要么从目标
绿豆中取出my\u classpath\u jars
的定义,要么将你的
放在那里。在调用目标之前,尝试查看你的refid是否已定义,你可以使用它来设置该引用id的属性。顺便说一下,设置id时通常使用id=
,获取id时通常使用refid=
。