﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Skynet-随笔分类-ant</title><link>http://www.blogjava.net/Good-Game/category/24763.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 25 Apr 2008 10:11:32 GMT</lastBuildDate><pubDate>Fri, 25 Apr 2008 10:11:32 GMT</pubDate><ttl>60</ttl><item><title>ant hbm 使用</title><link>http://www.blogjava.net/Good-Game/archive/2008/04/25/195920.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Fri, 25 Apr 2008 03:31:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2008/04/25/195920.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/195920.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2008/04/25/195920.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/195920.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/195920.html</trackback:ping><description><![CDATA[你可以参考：<a id="viewpost1_TitleUrl" class="singleposttitle" href="../archive/2008/03/26/188784.html">快速修改 xdoclet samples ant -build.xml 适应实际开发</a><br />此文档为上面的改进版。<br /><br />1.在 你电脑上建一个 ant第三方扩展文件夹，我这为:D:\ant\lib<br />2.当使用 eclipse-&gt;window-&gt;proferences..-&gt;ant-&gt;Runtime-&gt;Global Entries-&gt;Add External JARs-&gt;选择你建的 ant_lib 下的全部jar;<br />3.并在Global Entries下加入你的 classpath <br /><br />使用现成的 xdoclet ant -&gt; 加入自己的 -&gt;<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="hbm2ddl"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="prepare"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mkdir </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${hbm2ddl.sql.dir}"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">taskdef <br />              </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="hbm2ddl"</span><span style="color: rgb(255, 0, 0);"><br />             classname</span><span style="color: rgb(0, 0, 255);">="org.hibernate.tool.ant.HibernateToolTask"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">taskdef</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hbm2ddl </span><span style="color: rgb(255, 0, 0);">destdir</span><span style="color: rgb(0, 0, 255);">="${hbm2ddl.sql.dir}"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                   </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">configuration </span><span style="color: rgb(255, 0, 0);">configurationfile</span><span style="color: rgb(0, 0, 255);">="../src/hibernate.cfg.xml"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />                   </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hbm2ddl </span><span style="color: rgb(255, 0, 0);">export</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);"> console</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> create</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> update</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> drop</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> outputfilename</span><span style="color: rgb(0, 0, 255);">="bestunix.sql"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hbm2ddl</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"> <br />          <font color="#006400"> &lt;!-- 支持 1.5 泛型请 </font></span><font color="#006400">搜索到xjavadoc最新1.5版本，下载，替换原来的xjavadoc-1.1.x，再次运行xdoclet任务，执行成功！</font><span style="color: rgb(0, 0, 0);"><font color="#006400"> --&gt;</font><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="sql"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="hbm2ddl"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        <br />         </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">sql </span><span style="color: rgb(255, 0, 0);">driver</span><span style="color: rgb(0, 0, 255);">="org.gjt.mm.mysql.Driver"</span><span style="color: rgb(255, 0, 0);"> password</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(255, 0, 0);">  userid</span><span style="color: rgb(0, 0, 255);">="root"</span><span style="color: rgb(255, 0, 0);"> autocommit</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);">  <br />                       url</span><span style="color: rgb(0, 0, 255);">="jdbc:mysql://localhost:3306/zhongqi?characterEncoding=gbk"</span><span style="color: rgb(255, 0, 0);"> <br />                        src</span><span style="color: rgb(0, 0, 255);">="../sql/data.sql"</span><span style="color: rgb(255, 0, 0);"> print</span><span style="color: rgb(0, 0, 255);">="yes"</span><span style="color: rgb(255, 0, 0);"> output</span><span style="color: rgb(0, 0, 255);">="sql_out.txt"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">  <br />              </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">sql</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">  <br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">    </span></div><br />成功后就可以：<br />    使用 xdoclet 面向对象建表 ；<br />    通过 ant -&gt; java2hbn, hbn2ddl,insertSql <br /><br />在开发过程中当要加 jar 方法为： <br />    1.在 ant_lib 中加入 jar<br />    2.eclipse -&gt;&gt; Global Entries-&gt;Add External JARs-&gt;<br />工程转换修改 Global Entries中的classpath<br /><br />例：<br />java<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> hbm;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.Set;<br /><br /></span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /> * @hibernate.class table = "level"<br /> * where = " visible = 0  "<br /> * </span><span style="color: rgb(128, 128, 128);">@author</span><span style="color: rgb(0, 128, 0);"> Administrator<br /> *<br /> </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> Level {<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> id ;<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> String name ;<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> Level father ;<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> Set</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> childSet ;<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> visible  ;<br /><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Level(){}<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Level(String name){  </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> name ; }<br />    <br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Level(String name,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> visible){</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.visible </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> visible;  </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> name ; }<br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * @hibernate.id generator-class = "identity"<br />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"><br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> getId() {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> id;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setId(</span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> id) {<br />        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.id </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> id;<br />    }<br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * @hibernate.property <br />     * length = "20"<br />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"><br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> String getName() {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> name;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setName(String name) {<br />        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> name;<br />    }<br />    <br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * @hibernate.many-to-one <br />     * cascade = "save-update"<br />     * inverse = "false"<br />     * column = "fid"<br />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"><br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Level getFather() {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> father;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setFather(Level father) {<br />        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.father </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> father;<br />    }<br />    <br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * @hibernate.set <br />     * lazy = "true"<br />     * table = "Level"<br />     * cascade = "save-update"<br />     * where = " visible = 0 "<br />     * @hibernate.collection-key column = "fid"<br />     * @hibernate.collection-one-to-many class = "hbm.Level"<br />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"><br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> Set</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> getChildSet() {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> childSet;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setChildSet(Set</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> childSet) {<br />        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.childSet </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> childSet;<br />    }<br />    <br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * @hibernate.property <br />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"><br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> getVisible() {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> visible;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setVisible(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> visible) {<br />        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.visible </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> visible;<br />    }<br />}<br /></span></div><br /><br />unit<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> test;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.HashSet;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.List;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.Set;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> hbm.Level;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.hibernate.Hibernate;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.hibernate.Session;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.hibernate.Transaction;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> org.junit.Test;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> unit.HibernateUtil;<br /><br /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> HbnUnit {<br />    @Test<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> level() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception {<br />        Session session </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> HibernateUtil.currentSession();<br />        Transaction tr </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  session.beginTransaction();<br />        <br />        Level level </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level();<br />        level.setName(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">f1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        <br />        Set</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> set </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> HashSet</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">();<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c2</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">));<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c3</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c4</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> ));<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c5</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> ));<br />            set.add(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Level(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c6</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> ));<br />        <br />        level.setChildSet(set);<br />        session.save(level);<br />        session.flush() ;<br />        session.clear();<br />        tr.commit();<br /><br />        <br />    }<br />    <br />    @Test<br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> sAll() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception {<br />        Session session </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> HibernateUtil.currentSession();<br />        <br />        System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">---------------------------------------------</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        List</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">Level</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> list </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  session.createQuery(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> from Level tl where tl.father is null </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">).list();<br />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">( Level tmp : list ){<br />            System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">----&gt;</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> tmp.getName()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> visible=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">tmp.getVisible()  );<br />            <br />            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(  Level tt : tmp.getChildSet() ){<br />                System.out.println( tt.getName()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> visible=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">tt.getVisible()  );<br />            }<br />            <br />        }<br />        System.out.println( list.get(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">).getVisible()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> list.size() );<br />    }<br />    <br />}<br /></span></div><br />结果：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">insert</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">into</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> (name, fid, visible) </span><span style="color: rgb(0, 0, 255);">values</span><span style="color: rgb(0, 0, 0);"> (?, ?, ?)<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />Hibernate: </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"> fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">? </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br /></span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">-------------------------------------------</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">Hibernate: </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> level0_.id </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> id0_, level0_.name </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> name0_, level0_.fid </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> fid0_, level0_.visible </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> visible0_ </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> level0_ </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> (  level0_.visible </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);"> ) </span><span style="color: rgb(128, 128, 128);">and</span><span style="color: rgb(0, 0, 0);"> (level0_.fid </span><span style="color: rgb(0, 0, 255);">is</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);">--</span><span style="color: rgb(0, 128, 128);">--&gt;f1 visible=0</span><span style="color: rgb(0, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">Hibernate: </span><span style="color: rgb(0, 0, 255);">select</span><span style="color: rgb(0, 0, 0);"> childset0_.fid </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> fid1_, childset0_.id </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> id1_, childset0_.id </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> id0_0_, childset0_.name </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> name0_0_, childset0_.fid </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> fid0_0_, childset0_.visible </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> visible0_0_ </span><span style="color: rgb(0, 0, 255);">from</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">level</span><span style="color: rgb(0, 0, 0);"> childset0_ </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);">  (  childset0_.visible </span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);"> )  </span><span style="color: rgb(128, 128, 128);">and</span><span style="color: rgb(0, 0, 0);"> childset0_.fid</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(0, 0, 0);">?<br />c1 visible</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);"><br />c5 visible</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);"><br />c3 visible</span><span style="color: rgb(128, 128, 128);">=</span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 0); font-weight: bold;">0</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(128, 0, 0); font-weight: bold;">1</span></div><br /><br /><br /><img src ="http://www.blogjava.net/Good-Game/aggbug/195920.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2008-04-25 11:31 <a href="http://www.blogjava.net/Good-Game/archive/2008/04/25/195920.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ant ftp 使用</title><link>http://www.blogjava.net/Good-Game/archive/2008/03/25/188441.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Tue, 25 Mar 2008 03:25:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2008/03/25/188441.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/188441.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2008/03/25/188441.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/188441.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/188441.html</trackback:ping><description><![CDATA[参考：<font color="#0000ff">http://lijunjie.javaeye.com/blog/160977</font><br />目的：方便部署文件，不再使用ssh的拷贝和粘贴。<br />使用：<br />ant 使用jar 包  jakarta-oro-2.0.1.jar;<br />                        <font color="#0000ff">http://archive.apache.org/dist/jakarta/oro/</font><br />                commons-net-1.4.1.jarhttp:<br />                        <font color="#0000ff">http://apache.mirror.phpchina.com/commons/net/binaries/</font><br /><br />加载到 eclipes ant 路径上；Window→ Preferences→ Ant→ Runtime+jar<br /><br />build -&gt; copy action<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0"</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">project</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="init"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">ftp </span><span style="color: rgb(255, 0, 0);">server</span><span style="color: rgb(0, 0, 255);">="xxx.xxx.xxx.xxx"</span><span style="color: rgb(255, 0, 0);">    <br />                   userid</span><span style="color: rgb(0, 0, 255);">="name"</span><span style="color: rgb(255, 0, 0);"><br />                   password</span><span style="color: rgb(0, 0, 255);">="pass"</span><span style="color: rgb(255, 0, 0);"><br />                  remotedir</span><span style="color: rgb(0, 0, 255);">="/usr/"</span><span style="color: rgb(255, 0, 0);"><br />                  action</span><span style="color: rgb(0, 0, 255);">="get"</span><span style="color: rgb(255, 0, 0);"><br />              </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="D:\\ant\\ftp_data"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">ftp</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">project</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span></div><br />本例小结：<br />    时间有限，这里就展现写这些。<br />    代码的部署方便了。<br />    听说 sftp 服务器可以用<br />        需要lib <a href="http://www.jcraft.com/jsch/index.html" target="_top">http://www.jcraft.com/jsch/index.html</a><br />        &lt;scp  trust="true" file="./src/Main.java" todir="root:pass@***.***.***.***:/tmp"  /&gt;<br />          <br />         &lt;sshexec .....&gt;远程运行命令！！！<br /><br />        还可以参考 命令 rsync http://www.oreilly.com.cn/samplechap/linuxserverhacks/ch38.pdf<br />    有时间 再尝试<br />                    <br />                    <br /><br /><br /><img src ="http://www.blogjava.net/Good-Game/aggbug/188441.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2008-03-25 11:25 <a href="http://www.blogjava.net/Good-Game/archive/2008/03/25/188441.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ant 项目实际</title><link>http://www.blogjava.net/Good-Game/archive/2007/12/12/167192.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Wed, 12 Dec 2007 04:23:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/12/12/167192.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/167192.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/12/12/167192.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/167192.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/167192.html</trackback:ping><description><![CDATA[
		<font color="#0000ff">原代码：http://www.blogjava.net/Files/Good-Game/myAnt.rar</font>
		<br />对一般开发 使用的ant<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0"</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">project </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="general"</span><span style="color: rgb(255, 0, 0);"> default</span><span style="color: rgb(0, 0, 255);">="doc"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 使用说明：<br />     需要设置的参数 ： src.dir 、 classes.dir<br /></span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> properies </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="src.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="src"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="lib.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="lib"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    <br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="report.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="report"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="classes.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="bin"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="dist.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="dist"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="doc.dir"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="doc"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);">   定义classpath </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">path </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="master-classpath"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">file</span><span style="color: rgb(0, 0, 255);">="${lib.dir}/*.jar"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">pathelement </span><span style="color: rgb(255, 0, 0);">path</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">path</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 初始化任务 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="init"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">copy </span><span style="color: rgb(255, 0, 0);">todir </span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">  <br />       </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir </span><span style="color: rgb(0, 0, 255);">="${src.dir}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"> <br />             </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/build.xml"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />             </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/*.java"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />          </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">  <br />       </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">copy </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">  <br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 编译 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="compile"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="init"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="compile the source files"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mkdir </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">javac </span><span style="color: rgb(255, 0, 0);">srcdir</span><span style="color: rgb(0, 0, 255);">="${src.dir}"</span><span style="color: rgb(255, 0, 0);"> destdir</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(255, 0, 0);"> target</span><span style="color: rgb(0, 0, 255);">="1.4"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">classpath </span><span style="color: rgb(255, 0, 0);">refid</span><span style="color: rgb(0, 0, 255);">="master-classpath"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">javac</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 测试 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="test"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="compile"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="run junit test"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mkdir </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${report.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">junit     </span><span style="color: rgb(255, 0, 0);">printsummary</span><span style="color: rgb(0, 0, 255);">="on"</span><span style="color: rgb(255, 0, 0);"><br />            haltonfailure</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"><br />            failureproperty</span><span style="color: rgb(0, 0, 255);">="tests.failed"</span><span style="color: rgb(255, 0, 0);"><br />            showoutput</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">classpath </span><span style="color: rgb(255, 0, 0);">refid</span><span style="color: rgb(0, 0, 255);">="master-classpath"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">formatter </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="plain"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">batchtest </span><span style="color: rgb(255, 0, 0);">todir</span><span style="color: rgb(0, 0, 255);">="${report.dir}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">include </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/Test*"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">batchtest</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">junit</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fail </span><span style="color: rgb(255, 0, 0);">if</span><span style="color: rgb(0, 0, 255);">="tests.failed"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />***********************************************************<br />**** One or more tests failed! Check the output <img src="http://www.blogjava.net/images/dot.gif" /> ****<br />***********************************************************<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fail</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 打包成jar </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="pack"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="test"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="make .jar file"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mkdir </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${dist.dir}"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">jar </span><span style="color: rgb(255, 0, 0);">destfile</span><span style="color: rgb(0, 0, 255);">="${dist.dir}/hello.jar"</span><span style="color: rgb(255, 0, 0);"> basedir</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/*Test.*"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/Test*.*"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">jar</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 输出api文档 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="doc"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="pack"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="create api doc"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mkdir </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${doc.dir}"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />      </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">javadoc<br />           </span><span style="color: rgb(255, 0, 0);">destdir</span><span style="color: rgb(0, 0, 255);">="${doc.dir}"</span><span style="color: rgb(255, 0, 0);"><br />           author</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);"><br />           version</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);"><br />           use</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(255, 0, 0);"><br />           windowtitle</span><span style="color: rgb(0, 0, 255);">="Test API"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="src"</span><span style="color: rgb(255, 0, 0);"> defaultexcludes</span><span style="color: rgb(0, 0, 255);">="yes"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">include </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/**.java"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/*Test.java"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">exclude </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/Test*.*"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">javadoc</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> clean doc </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="clean_doc"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="create api doc"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">delete </span><span style="color: rgb(255, 0, 0);">includeEmptyDirs </span><span style="color: rgb(0, 0, 255);">= "true"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${doc.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">delete </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> clean class and lib </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="clean_class_dist"</span><span style="color: rgb(255, 0, 0);">  description</span><span style="color: rgb(0, 0, 255);">="create class dist"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />     </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">delete</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${classes.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${dist.dir}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);">       <br />     </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">delete </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">project</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br /><br />ant XDoclet Generation<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8"</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">project </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="ant XDoclet Generation"</span><span style="color: rgb(255, 0, 0);"> default</span><span style="color: rgb(0, 0, 255);">="_xdoclet_generation_"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">file</span><span style="color: rgb(0, 0, 255);">="xdoclet-build.properties"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 使用说明：<br />     需要设置的参数 ： java.home 、 xdoclet.home <br /></span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">environment</span><span style="color: rgb(0, 0, 255);">="env"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="java.home"</span><span style="color: rgb(255, 0, 0);"> value</span><span style="color: rgb(0, 0, 255);">="${env.JAVA_HOME}"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"> <br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property     </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="xdoclet.home"</span><span style="color: rgb(255, 0, 0);"> <br />            value</span><span style="color: rgb(0, 0, 255);">="D:\hbn\hibernate-3.2\xdoclet-1.2.3"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    <br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">path </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="xdoclet.classpath"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">pathelement </span><span style="color: rgb(255, 0, 0);">location</span><span style="color: rgb(0, 0, 255);">="${java.home}/**/*.jar"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="${xdoclet.home}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">include </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="**/*.jar"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">path</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="_xdoclet_generation_"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="N10004"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">target </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="N10004"</span><span style="color: rgb(255, 0, 0);"> description</span><span style="color: rgb(0, 0, 255);">="Standard Hibernate"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">taskdef </span><span style="color: rgb(255, 0, 0);">classpathref</span><span style="color: rgb(0, 0, 255);">="xdoclet.classpath"</span><span style="color: rgb(255, 0, 0);"> <br />         classname</span><span style="color: rgb(0, 0, 255);">="xdoclet.modules.hibernate.HibernateDocletTask"</span><span style="color: rgb(255, 0, 0);"> <br />         name</span><span style="color: rgb(0, 0, 255);">="hibernatedoclet"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /> <br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hibernatedoclet </span><span style="color: rgb(255, 0, 0);">excludedTags</span><span style="color: rgb(0, 0, 255);">="@version,@author,@todo,@see"</span><span style="color: rgb(255, 0, 0);">  <br />                 destDir</span><span style="color: rgb(0, 0, 255);">="src"</span><span style="color: rgb(255, 0, 0);">  <br />                 addedTags</span><span style="color: rgb(0, 0, 255);">="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">fileset </span><span style="color: rgb(255, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">="src"</span><span style="color: rgb(255, 0, 0);">  includes</span><span style="color: rgb(0, 0, 255);">="**/*.java"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">fileset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hibernate</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hibernate</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hibernatedoclet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">target</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">project</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span></div><br /><img src ="http://www.blogjava.net/Good-Game/aggbug/167192.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-12-12 12:23 <a href="http://www.blogjava.net/Good-Game/archive/2007/12/12/167192.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> 制定自己 ant  标签</title><link>http://www.blogjava.net/Good-Game/archive/2007/04/11/109946.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Wed, 11 Apr 2007 09:11:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/04/11/109946.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/109946.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/04/11/109946.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/109946.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/109946.html</trackback:ping><description><![CDATA[/src/my/test.java<br><br>package my ;<br><br>import java.util.Date ;<br><br>public class test{<br>&nbsp;&nbsp;&nbsp; private String name ;<br>&nbsp;&nbsp;&nbsp; private Date nowTime ;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public void setName(String name){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.name = name ;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; public String getName(){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return this.name;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public void setNowTime(String nowTime)throws Exception{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.nowTime = (Date)(Class.forName( nowTime ).newInstance()) ;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; public Date getNowTime(){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return this.nowTime ;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public void execute(){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("ok : "+name+" : "+nowTime);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>}<br>&nbsp;/////////////////////////////////////////// ant /////////////////////////////////// <br><br>&lt;?xml version="1.0"?&gt;<br><br>&lt;project name="test" default="compile"&gt;<br><br>&nbsp;&nbsp;&nbsp; &lt;property name="src" location="src" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;property name="build" location="build" /&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;target name="init"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;mkdir dir="${build}" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/target&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;target name="compile" depends="init"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;javac srcdir="${src}" destdir="${build}" /&gt;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;/target&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;target name="test" depends="compile"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;taskdef name="test" classname="my.test" classpath="${build}" /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;test<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name="liukaiyi"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; nowTime="java.util.Date"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/target&gt;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &lt;target name="delete"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;delete dir="${build}" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/target&gt;<br>&nbsp;&nbsp;&nbsp; <br>&lt;/project&gt;<br><br><br><img src="http://www.blogjava.net/CuteSoft_Client/CuteEditor/images/emwink.gif" align="absmiddle" border="0">代码先上哈　<br>我感觉　可以　动态的写配置 ant 　并动态运行　ant 　再把　新生成的　对象放在　jvm 中　动态的使用　<br>新手　多指教 <br> <img src ="http://www.blogjava.net/Good-Game/aggbug/109946.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-04-11 17:11 <a href="http://www.blogjava.net/Good-Game/archive/2007/04/11/109946.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>