I am running an Ant script that is part of a tutorial at http://maestric.com/doc/java/spring/setup
The error is:
BUILD FAILED
Target “buildtests” does not exist in the project “null”.
I am running Ant through eclipse.
The Ant script is:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build">
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="build.dir" value="classes"/>
<path id="build.classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${appserver.lib}"> <!-- servlet API classes: -->
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="build">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="clean" description="Clean output directories">
<delete>
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</delete>
</target>
</project>
I often have such problems with Ant, when it seems an error is caused by something that has never been declared in my script.
This sounds bizarre. Did you get Ant from Apache? Are there any build.xml files nearby with “buildtests” in them? Is this on a unix-based OS? If so, find the Ant script by doing a “which” and then examine its contents to see if it is trying to invoke some other build file.