Ant Eclipse IDE Integration
Ant > Ant Eclipse IDE Integration
|
||
Ant Eclipse IDE IntegrationTo integrate Ant build file with the Eclipse IDE, first create a build.xml file, right click the project select New->Other->XML, enter the name as build.xml and click Finish. Eclipse IDE 集成Ant,首先要创建一个build.xml文件.右击工程选择 New->Other->XML,键入build.xml点击Finish.
<?xml version="1.0" ?> <project name="Ant Example" default="execute"> <target name="init" depends="clean"> <mkdir dir="build/classes" /> </target> <target name="compile" depends="init"> <javac srcdir="src" destdir="build/classes" /> </target> <target name="execute" depends="compile"> <java classname="com.vaannila.helloworld.HelloWorld" classpath="build/classes" /> </target> <target name="clean"> <delete dir="build" /> </target> </project> To build the project right click the build.xml file and select Ant Build. build工程右击build.xml选择 Ant Build. The HelloWorld.java file will be compiled and executed. The following message shows the sequence of events that happen once the build file is executed. HelloWorld.java文件就会编译并运行.下面信息会依此显示出来.
Buildfile: E:\Eclipse Workspace\AntExample\build.xml clean: [delete] Deleting directory E:\Eclipse Workspace\AntExample\build init: [mkdir] Created dir: E:\Eclipse Workspace\AntExample\build\classes compile: [javac] Compiling 1 source file to E:\Eclipse Workspace\AntExample\build\classes execute: [java] Hello World! BUILD SUCCESSFUL Total time: 625 milliseconds You can download the build file here.
|