我对Ant很陌生,但我有一个大致的了解。我无法让它发挥作用。
<?xml version="1.0"?>
<project name="Ser321 Assignment 3 Java Movie Library with Ant build file and API support."
default="targets" basedir="."
xmlns:dn="antlib:org.apache.ant.dotnet"
xmlns="antlib:org.apache.tools.ant"
xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib" />
<property name="build" value="classes"/>
<property name="bin" value="bin"/>
<property name="obj" value="obj"/>
<property environment="env"/>
<property name="user" value="${env.USERNAME}"/>
<target name="targets">
<echo message="Targets are clean, prepare, build, execute, and targets"/>
</target>
<path id="compile.classpath">
<pathelement location="${build}"/>
</path>
<path id="external.classpath">
<pathelement location="${lib.dir}/json.jar"/>
</path>
<target name="prepare">
<mkdir dir="${build}" />
<mkdir dir="${bin}"/>
<mkdir dir="${obj}"/>
</target>
<target name="clean">
<delete dir="${build}" failonerror="false"/>
<delete dir="${bin}" failonerror="false"/>
<delete dir="${obj}" failonerror="false"/>
</target>
<target name="build" depends="prepare">
<javac srcdir="${src.dir}"
includeantruntime="false"
destdir="${build}">
<classpath refid="external.classpath"/>
</javac>
</target>
<target name="execute.jar" depends="build"
description="Run the program">
<java classname="Main" fork="yes">
<classpath refid="compile.classpath"/>
</java>
</target>
</project>
这给了我带有电影作为下一个文件夹的classes文件夹,然后在那里,我有了3个班级。然而,它一直说课没找到,我不知道我做错了什么。
答案 0 :(得分:0)
想出来。我有时候是个空头。
<target name="execute.jar" depends="build"
description="Run the program">
<java classname="movie.Main" fork="yes"> //added movie.main instead of Main
<classpath refid="compile.classpath"/>
</java>