2017-04-16 6 views
0

ここに私のコードはxmlは私の終了タグを認識していませんか?

<?xml version="1.0" encoding="UTF-8"?> 
    <project name="ant" default="main" basedir="."> 

    <!-- Vytvorime si cesty--> 
    <property name="src.dir" location="ija/ija2016/homework2"/> 
    <oroperty name="build.dir" location="bin"/> 
    <property name="test.output.dir" location="output"/> 

    <path id="junit.class.path"/> 
     <pathelement location="lib/junit.jar"/> 
     <pathelement location="${build.dir}"/> 
    </path> 


    <!-- Funkcia pre vytvorenie adresarov --> 
    <target name="makedir"> 
      <mkdir dir="${build.dir}" /> 
      <mkdir dir="${test.output.dir}" /> 
    </target> 


    <!-- Funkcia pre vymazanie adresarov --> 
     <target name="clean"> 
       <delete dir="${build.dir}" /> 
       <delete dir="${test.output.dir}" /> 
     </target> 



     <!-- Compile funkcia pre 3. ulohu --> 
     <target name="compile"> 
      <javac srcdir="${src.dir}" destdir="${build.dir}"> 
      <classpath refid="junit.class.path"/> 
      </javac> 


      <!-- Run funkcia pre 3. ulohu --> 
      <target name="run" depends="compile"> 
       <junit printsummary="on" fork="true" haltonfailure="yes"> 
         <classpath refid="junit.class.path" /> 
         <formatter type="xml" /> 
         <batchtest todir="${test.output.dir}"> 
           <fileset dir="${src.dir}"> 
             <include name="**/*HomeWork2Test*.java" /> 
           </fileset> 
         </batchtest> 
       </junit> 
     </target> 

     <target name="main" depends="compile, junit"> 
       <description>Ant pre spustenie testov HomeWork2Test</description> 
     </target> 

</project> 

だここに私のエラーコードがあります:

BUILDは
/(ファイルへのパスを)FAILED /build.xml:12:要素型 "プロジェクト" が終了しなければなりません一致する終了タグ"</project>"によって。

私のコードにもかかわらず、終了する</project>タグがあります。どんなアイデアが間違っているの?

答えて

1

あなたのパスXML

<path id="junit.class.path"/> 
    <pathelement location="lib/junit.jar"/> 
    <pathelement location="${build.dir}"/> 
</path> 

pathタグを終了し、最初の行にスラッシュが含まれています。

変更

<target name="compile"> 
     <javac srcdir="${src.dir}" destdir="${build.dir}"> 
     <classpath refid="junit.class.path"/> 
     </javac> 


     <!-- Run funkcia pre 3. ulohu --> 
     <target name="run" depends="compile"> 
      <junit printsummary="on" fork="true" haltonfailure="yes"> 
        <classpath refid="junit.class.path" /> 
        <formatter type="xml" /> 
        <batchtest todir="${test.output.dir}"> 
          <fileset dir="${src.dir}"> 
            <include name="**/*HomeWork2Test*.java" /> 
          </fileset> 
        </batchtest> 
      </junit> 
    </target> 

    <target name="main" depends="compile, junit"> 
      <description>Ant pre spustenie testov HomeWork2Test</description> 
    </target> 
+0

ああ私の悪い後

<path id="junit.class.path"> 

あなたはまた、</target>終了タグを必要とする最初の行は、エラー・ダンプは、実際のエラーが嘘をついたところのように、私は混乱しました。私はそれが適切な構文の強調表示/整列といくつかのエディタを使用していないため、私の悪いと思う。助けてくれてありがとう :) – Rawrplus