Reputation: 642
> BUILD FAILED
> C:\Users\dt208672\Perforce\depot\ebill\Automation\Selenium_eBill\RunningPower\build.xml:37:
> Problem: failed to create task or type classpath Cause: The name is
> undefined. Action: Check the spelling. Action: Check that any custom
> tasks/types have been declared. Action: Check that any
> <presetdef>/<macrodef> declarations have taken place.
This is the error when trying to build my application with Apache Ant. Seems like the error is related to with the classpath. My program is able to compile but does not run. I was told the fix to this problem would be to include the classpath during run time, however, the problem still persist. Maybe what I have written is incorrect? Not sure
<?xml version="1.0" ?>
<project name="SeleniumProjectDataDriven" basedir="." default="run">
<target name="init">
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/class" />
<property name="lib.dir" value="RunningPowerJars" />
</target>
<target name="clean" depends="init">
<delete dir="build"/>
</target>
<target name="compile" description="Compiles the code" depends="clean" >
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
<classpath>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="jar" description="Packages the code into jar" depends="compile">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/RunningPower.jar" basedir="build/class">
<manifest>
<attribute name="Main-Class" value="RunningPower"/>
</manifest>
</jar>
</target>
<target name="run" description="Run the jar file" depends="jar" >
<java jar="build/jar/RunningPower.jar" fork="true">
<classpath>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
Upvotes: 1
Views: 2635