执行Haxe代码时Ant构建失败

Ant build Failed while executing Haxe code

本文关键字:构建 失败 Ant Haxe 代码 执行      更新时间:2023-09-26

嗨,我是Haxe的新手,正在尝试构建执行Haxe文件到js文件的ANT脚本。Bellow是我的build.xml文件,如果我缺少什么,请纠正我,错误显示它找不到Haxe类"HelloWorld"。HelloWorld.hx位于aha/文件夹中,我已将其包含在"Sourcefiles"中

<?xml version="1.0" ?>
<project name="AHA" default="main" basedir=".">
    <description>
        Simple example build file
    </description>
    <property name="buildDir" value="./buildFiles"/>
  <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
      <pathelement location="./tools/ant/ant-contrib-0.3.jar" />
    </classpath>
  </taskdef>
    <target name="clean" description="Remove all generated files.">
        <delete dir="${buildDir}/" />
    </target>
    <target name="main" depends="clean">
        <!-- <property name="debug.target.app" value="app.js" /> -->
        <mkdir dir="${buildDir}" />
    <outofdate>
        <sourcefiles>
        <fileset dir="./aha/">
          <include name="**/*.hx" />
        </fileset>
    </sourcefiles>
    <targetfiles path="${buildDir}/*.js" />
    <sequential>
        <exec failonerror="true" executable="haxe">
          <!-- arg line="-lib polygonal-core -lib createjs" /-->
          <arg value="-js" />
          <arg file="${buildDir}" />
          <arg line="HelloWorld" />
    </exec>
    </sequential>
  </outofdate>
  </target>
</project>

当我运行ant命令行时,我得到的错误是

C:'Users'vishwanath.kolkar'Desktop'ahaproject>ant
Buildfile: C:'Users'vishwanath.kolkar'Desktop'ahaproject'build.xml
clean:
   [delete] Deleting directory C:'Users'vishwanath.kolkar'Desktop'ahaproject'bui
ldFiles
main:
    [mkdir] Created dir: C:'Users'vishwanath.kolkar'Desktop'ahaproject'buildFile
s
     [exec] Class not found : HelloWorld
BUILD FAILED
C:'Users'vishwanath.kolkar'Desktop'ahaproject'build.xml:30: exec returned: 1
Total time: 0 seconds
<exec failonerror="true" executable="haxe">
          <!-- arg line="-lib polygonal-core -lib createjs" /-->
          <arg value="-js" />
          <arg line="-cp aha/" />
          <arg file="${buildDir}" />
          <arg line="HelloWorld" />
    </exec>

这将找到我试图访问的类,我忘记添加类路径,即-cp aha/This aha/文件夹包含我的HelloWorld.hx,类名为HelloWorld。