2012-10-26 8 views
2

일부 refid 값을 정의하는 common.xml 파일을 포함하는 build.xml 파일이 있습니다. 그러나, 내 작업 refid 값을 볼 수 없습니다. 나는 웹상에서 해결책을 찾을 수 없었고 도움을 찾고있다.개미 스크립트가 refid를 보지 못했습니다.

나는 build.xml 파일에서 genbeans 대상을 호출합니다. 참조 my_classpath_jars를 찾을 수 없음이라는 메시지와 함께 xmlbean taskdef에서 실패합니다. 대상을 호출 할 때

의 build.xml은

---------------------------- 
[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> 
+0

대상을 호출하기 전에 refids가 정의되어 있는지 확인하십시오. 를 사용하여 해당 참조 ID에 대한 속성을 설정할 수 있습니다. 그런데 id를 설정할 때'id ='를 사용하고 id를 얻을 때'refid ='를 사용합니다. –

답변

1

의문이 ant -d 스위치를 사용하십시오. 1 톤의 출력을 볼 수 있습니다. 파일에 저장하고 파싱합니다.

그렇게, 당신은 출력에 알 수 있습니다 첫 번째 것은 그것이 정의라는 것이다 당신의 당신이 당신의 my_classpath_jars를 정의 전에 taskdef . 그 my_classpath_jars refid는 greenbeans 표적이라고 부를 때만 설정됩니다. <taskdef>은 대상이 호출되기 전에 실행됩니다.

my_classpath_jars의 정의를 대상 greenbeans에서 꺼내거나 <taskdef>을 넣으십시오.

관련 문제