当我尝试在 Flash Builder 中运行 Ant 构建脚本时,会生成错误。所以我把export FLEX_HOME=/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0/
我的.zshrc
. 这在命令行中可以正常工作,但在 FB 中不行。
构建.xml
<?xml version="1.0"?>
<project name="helloworld" basedir="../" default="compile">
<!-- Set up prefix for all environment variables -->
<property environment="env" />
<fail unless="env.FLEX_HOME" message="FLEX_HOME needs to be defined as an environment variable or in the Ant build." />
<!-- Load user properties to overrride defaults -->
<property file="${basedir}/build/build.properties" />
<!-- System environment must contain FLEX_HOME variable that points to Flex SDK -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<!-- Set up Flex tasks in Ant -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- Create directories needed for the build process -->
<target name="init" description="Initializes project and destination folders.">
<echo message="Project: ${ant.project.name}" />
<echo message="Flex SDK: ${FLEX_HOME}" />
<echo message="Flex home is ${env.FLEX_HOME}" />
<delete dir="${bin.dir}" />
<mkdir dir="${bin.dir}" />
</target>
<target name="compile" depends="init" description="Compiles the application.">
<mxmlc file="${src.dir}/${application.name}.as" output="${bin.dir}/${application.name}.swf">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${src.dir}" />
</mxmlc>
<echo message="The ${application.name}.swf has been created in ${bin.dir}" />
</target>
</project>
和错误
Buildfile: /Users/gadzimari/Documents/Adobe Flash Builder 4.7/helloworld/build/build.xml
BUILD FAILED
/Users/gadzimari/Documents/Adobe Flash Builder 4.7/helloworld/build/build.xml:5: FLEX_HOME needs to be defined as an environment variable or in the Ant build.
Total time: 302 milliseconds