kakakakakku blog

Weekly Tech Blog: Keep on Learning!

style task は使わず xslt task を使う

Antで style task と xslt task は同じ動きをするが,Ant 1.8.4 で試してみたところ,以下のエラーが出たので,style task は @Deprecated になってるらしい.なので,同じ動きだからどちらでも良いというわけではなく,基本的に xslt task に統一するべき.

[style] Warning: the task name <style> is deprecated. Use <xslt> instead.

例えば checkstyle - Ant Taskに載ってるサンプルでも style task が使われているが,これも xslt task にした方が良さそう.

<target name="checkstyle"
        description="Generates a report of code convention violations.">

  <checkstyle config="docs/sun_checks.xml"
              failureProperty="checkstyle.failure"
              failOnViolation="false">
    <formatter type="xml" tofile="checkstyle_report.xml"/>
    <fileset dir="src" includes="**/*.java"/>
  </checkstyle>

  <!--<style in="checkstyle_report.xml" out="checkstyle_report.html" style="checkstyle.xsl"/>-->
  <xslt in="checkstyle_report.xml" out="checkstyle_report.html" style="checkstyle.xsl"/>

</target>