快速业务通道

Eclipse快速上手指南 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-25
> <mkdir dir="${dist.dir}" /> <jar destfile="${dist.dir}/hello.jar" basedir="${classes.dir}"> <exclude name="**/*Test.*" /> <exclude name="**/Test*.*" /> </jar> </target> <!-- 输出api文档 --> <target name="doc" depends="pack" description="create api doc"> <mkdir dir="${doc.dir}" /> <javadoc destdir="${doc.dir}" author="true" version="true" use="true" windowtitle="Test API"> <packageset dir="${src.dir}" defaultexcludes="yes"> <include name="example/**" /> </packageset> <doctitle><![CDATA[<h1>Hello, test</h1>]]></doctitle> <bottom><![CDATA[<i>All Rights Reserved.</i>]]></bottom> <tag name="todo" scope="all" description="To do:" /> </javadoc> </target> </project>

Eclipse快速上手指南(4)

时间:2009-11-22

以上xml依次定义了init(初始化),compile(编译),test(测试),doc(生成文档),pack(打包)任务,可以作为模板。

选中Hello工程,然后选择“Project”,“Properties”,“Builders”,“New…”,选择“Ant Build”:

Eclipse快速上手指南 - 编程入门网

填入Name:Ant_Builder;Buildfile:build.xml;Base Directory:${workspace_loc:/Hello}(按“Browse Workspace”选择工程根目录),由于用到了junit.jar包,搜索Eclipse目录,找到junit.jar,把它复制到Hello/lib目录下,并添加到Ant的Classpath中:

Eclipse快速上手指南 - 编程入门网

然后在Builder面板中钩上Ant_Build,去掉Java Builder:

Eclipse快速上手指南 - 编程入门网

再次编译,即可在控制台看到Ant的输出:

Buildfile: F:\eclipse-projects\Hello\build.xml init: compile: [mkdir] Created dir: F:\eclipse-projects\Hello\classes [javac] Compiling 2 source files to F:\eclipse-projects\Hello\classes test: [mkdir] Created dir: F:\eclipse-projects\Hello\report [junit] Running example.HelloTest [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.02 sec pack: [mkdir] Created dir: F:\eclipse-projects\Hello\dist [jar] Building jar: F:\eclipse-projects\Hello\dist\hello.jar doc: [mkdir] Created dir: F:\eclipse-projects\Hello\doc [javadoc] Generating Javadoc [javadoc] Javadoc execution [javadoc] Loading source files for package example... [javadoc] Constructing Javadoc information... [javadoc] Standard Doclet version 1.4.2_04 [javadoc] Building tree for all the packages and classes... [javadoc] Building index for all the packages and classes... [javadoc] Building index for all classes... [javadoc] Generating F:\eclipse-projects\Hello\doc\stylesheet.css... [javadoc] Note: Custom tags that could override future standard tags: @todo. To avoid potential overrides, use at least one period character (.) in custom tag names. [javadoc] Note: Custom tags that were not seen: @todo BUILD SUCCESSFUL Total time: 11 seconds

Ant依次执行初始化,编译,测试,打包,生成API文档一系列任务,极大地提高了开发效率。将

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号