我在Eclipse Helios中有一个spring web应用程序。我在其他项目中使用Ant进行构建,但不熟悉如何初始设置Ant构建文件。是否有一种轻松的方法可以从使用Eclipse进行构建过渡到创建Ant构建文件和任何支持文件?我尝试将基本的Ant构建文件复制到我的应用程序中,但我不确定它是否接近我所需要的。我把它包括在下面。当我运行它时,它给了我这个错误。
BUILD FAILED
C:....workspace..build.xml:21: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
我的系统JAVA_HOME路径设置为'C:Program FilesJavajdk1.7.0bin'
<?xml version="1.0" encoding="UTF-8"?>
<project name="projectName" default="dist" basedir=".">
<description>
build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the News-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/ProjectName-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
不要在JAVA_HOME
中包含bin
文件夹
试试这个:
C:Program FilesJavajdk1.7.0