我有一个用FlashDevelop构建的项目。它不是AIR应用程序,但因为我们正在使用Starling,所以我们正在使用AIR sdk(v14)进行编译。从FlashDevelop运行项目工作正常。我正在研究最终将在Hudson中使用的ANT脚本。运行脚本时出现以下错误:
BUILD FAILED
C:\project\client\build.xml:50: File does not exist: compiler.jar
at com.adobe.flash.compiler.ant.FlexTask.resolveClass(FlexTask.java:404)
at com.adobe.flash.compiler.ant.FlexTask.executeInProcess(FlexTask.java:
300)
at com.adobe.flash.compiler.ant.FlexTask.execute(FlexTask.java:260)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
这是ANT脚本
<project name="Flex Ant Build Script" default="init">
<property environment="env"/>
<property name="FLEX_HOME" value="${env.FLEX_HOME}" />
<property name="AIRSDK_HOME" value="C:/Users/user/AppData/Local/FlashDevelop/Apps/ascsdk/14.0.0" />
<taskdef resource="flexTasks.tasks" classpath="${AIRSDK_HOME}/ant/lib/flexTasks.jar"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${env.ANT_HOME}/lib/ant-contrib-0.6.jar" />
</classpath>
</taskdef>
<target name="init">
<property name="INPUT_FILE_NAME" value="Main.as"/>
<property name="OUTPUT_FILE_NAME" value="Main"/>
<property name="OUTPUT_FILE_EXT" value="swf"/>
<property name="SRC_DIR" value="${basedir}/src"/>
<property name="OUTPUT_FOLDER" value="${basedir}/deploy"/>
<property name="DEBUG" value="false"/>
<property name="OPTIMIZE" value="true"/>
<property name="LOCALE" value="en_US"/>
<property name="STATIC_LINK" value="true"/>
<property name="STRICT" value="false"/>
<property name="WARNINGS" value="false"/>
</target>
<target name="clean" depends="init">
<delete includeemptydirs="true" verbose="true">
<fileset dir="${OUTPUT_FOLDER}" includes="**/*"/>
</delete>
</target>
<target name="compile" depends="init">
<echo>output = ${OUTPUT_FOLDER}/${OUTPUT_FILE_NAME}.${OUTPUT_FILE_EXT}</echo>
<echo>${AIRSDK_HOME}</echo>
<property name="AIR_LIB" value="C:/Users/user/AppData/Local/FlashDevelop/Apps/ascsdk/14.0.0/frameworks/libs/air"/>
<mxmlc file="${SRC_DIR}/${INPUT_FILE_NAME}"
output="${OUTPUT_FOLDER}/${OUTPUT_FILE_NAME}.${OUTPUT_FILE_EXT}"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
locale="${LOCALE}"
static-rsls="${STATIC_LINK}"
strict="${STRICT}"
warnings="${WARNINGS}">
<library-path dir="${AIRSDK_HOME}" includes="asc-support.swc" append="true"/>
<library-path dir="${AIRSDK_HOME}" includes="core.swc" append="true"/>
<library-path dir="${AIR_LIB}" includes="aircore.swc" append="true"/>
<library-path dir="${AIR_LIB}" includes="applicationupdater.swc" append="true"/>
<library-path dir="${AIR_LIB}" includes="applicationupdater_ui.swc" append="true"/>
<library-path dir="${AIR_LIB}" includes="servicemonitor.swc" append="true"/>
</mxmlc>
</target>
我已经通过FlexTasks.jar挖掘了Flex和AIR,它们有很大的不同(应该是这样)。我已经尝试将FlexTasks.jar从每个ant / lib移动到$ {ANT_HOME} / lib并且没有用(因为我已在其他帖子中阅读过)。现在我处于完全的僵局,因为我是一个相对较新的ANT。任何帮助将不胜感激。
由于
答案 0 :(得分:1)
ant <mxmlc>
任务记录很少,行为与mxmlc
命令的CLI版本不同,并且AIRSDK没有为任务提供mxmlc.jar
。
我已经放弃了它,尽管多次尝试这样做。
通过ANT使用命令行版本。我在下面的代码中使用了您的媒体资源名称。
<property name="mxmlc.jar" value="${AIRSDK_HOME}/lib/mxmlc-cli.jar"/>
<!-- ${FLEX_SDK}/lib/mxmlc.jar is not used, has issues with AIR related projects -->
<!-- <mxmlc> task is not used, poorly documented and behaves differently than cli -->
<!-- also, AIRSDK does not come with mxmlc.jar required for <mxmlc> task -->
<!-- Prepare command line -->
<property name="argline_compileBuildType"
value="-debug=${DEBUG} -optimize=${OPTIMIZE}"/>
<property name="argline_compileConfig"
value="+flexlib='${AIRSDK_HOME}/frameworks'"/>
<property name="argline_compileFiles"
value="-output=${OUTPUT_FOLDER}/${OUTPUT_FILE_NAME}.${OUTPUT_FILE_EXT} ${SRC_DIR}/${INPUT_FILE_NAME}"/>
<property name="argline_compileLibPath"
value="-library-path+=${AIRSDK_HOME}/asc-support.swc -library-path+=${AIR_LIB}/aircore.swc "/>
<!-- Show command line arguments and execute -->
<echo message="Executing: ${argline_compileBuildType} ${argline_compileConfig} ${argline_compileFiles} ${argline_compileLibPath}"/>
<java jar="${mxmlc.jar}" fork="true" failonerror="true">
<arg line="${argline_compileBuildType}"/>
<arg line="${argline_compileConfig}"/>
<arg line="${argline_compileFiles}"/>
<arg line="${argline_compileLibPath}"/>
</java>
请参阅 following reference for more command line options ,了解${LOCALE}
和${STATIC_LINK}