1. Eclipse typically comes with ant functionality, but the ability to automatically generate ant scripts is more subtle and difficult to find:
(1) Right-click on the project to generate Build.xml->export->export.
(2) In the popup dialog box, select Ant Build in general and click Next.
(3) Select item Click Finish. A build.xml file is automatically generated in the project directory.
2. The following error occurred using the Ant build project:
BUILD FAILED
D:\workspace\demo\build.xml:62:unable to find a javac compiler;
Com.sun.tools.javac.Main isn't on the classpath.
Perhaps Java_home does not point to the JDK.
This is due to a problem with the JDK path used by eclipse, which binds the available JDK paths to eclipse. As follows:
(1) eclipse->windows->preference->java->installed jdk-> Click the Add button, then select the standard JVM in the Add JRE dialog box and click Next.
(2) JRE Home Select the correct JDK installation path, others remain default, click Finish.
(3) Go back to the Preference dialog box and select the JDK you just added, click OK.
At this point, the rebuild succeeds.
Build
:
BUILD Successful
Total time:421 milliseconds.
Rookie shot--eclipse with Ant one of the two