ant的定義如下:
<taskdef name="java2html"
classname="de.java2html.anttasks.Java2HtmlTask"
classpath="${lib.dir}"
/>
<java2html
srcdir="${src.dir}"
destdir="htmlsource"
includes="**/*.java"
style="Kawa"
showLineNumbers="true"
showFileName="true"
overwrite="true"
showTableBorder="true"
addLineAnchors="true"
/>
生成結果:
注意:
1 你必須把java2html.jar放到ant的lib包內
2 我把生成的html文件放到htmlsource文件夾,你可以自己更改
下面是生成結果:
007 /**
008 * @author diegoyun
009 * @version 1.0
010 */
011 public class XMLParser {
012 private XMLReader xmlReader = null ;
013 private String rootNodeName = null ;
014
015 public XMLParser ( String url ) throws XMLParserException {
016
017 this .xmlReader = new XMLReader ( url ) ;
018 this .rootNodeName = xmlReader.getRootNodeName () ;
019
020 }
感謝該作者的無私分享.