我有一个名为framework
的灵活项目和另一个名为commons
的项目。 Commons依赖于框架。
构建框架脚本:
<project name="imanager-framework" basedir=".">
<property name="src" location="src"/>
<property name="dist" location="dist"/>
<property name="FLEX_HOME" value="C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/4.6.0"/>
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasksFlash4.jar"/>
<target name="clean">
<delete dir="${dist}"/>
</target>
<target name="dist">
<echo>src dir: ${src}</echo>
<mkdir dir="${dist}"/>
<compc output="${dist}/${ant.project.name}.swc">
<source-path path-element="src" />
<library-path dir="libs" includes="*.swc" append="true"/>
<include-sources dir="${src}" includes="*" />
</compc>
</target>
</project>
为公地构建脚本:
<?xml version="1.0" encoding="UTF-8"?>
<project name="imanager-commons" basedir=".">
<property name="src" location="src"/>
<property name="dist" location="dist"/>
<property name="FLEX_HOME" value="C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/4.6.0"/>
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasksFlash4.jar"/>
<target name="clean">
<delete dir="${dist}"/>
</target>
<target name="init">
<echo>Running Target: init</echo>
<echo>Running ant dist on framework</echo>
<!-- THIS PART FAILS --> <ant dir="../framework/" target="dist" inheritall="false"/>
<copy file="../framework/dist/imanager-framework.swc" todir="libs"/>
</target>
<target name="dist" depends="init">
<mkdir dir="${dist}"/>
<compc output="${dist}/${ant.project.name}.swc">
<source-path path-element="src" />
<library-path dir="libs" includes="*.swc" append="true"/>
<include-sources dir="${src}" includes="*" />
</compc>
</target>
</project>
从commons构建文件调用<ant>
会给我带来关于错误导入和未找到类的错误编译错误。但是单独运行框架的构建不会产生任何错误。
这是我得到的一些输出
Buildfile: E:\flexspace\imanager\commons\build.xml
init:
[echo] Running Target: init
[echo] Running ant dist on framework
Trying to override old definition of task asdoc
Trying to override old definition of task compc
Trying to override old definition of task mxmlc
Trying to override old definition of task html-wrapper
dist:
[echo] src dir: E:\flexspace\imanager\framework\src
[compc] Loading configuration file C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\flex-config.xml
...some warnings from my code here...
[compc] E:\flexspace\imanager\framework\src\com\iwobanas\controls\dataGridClasses\MDataGridColumn.as(72): col: 88 Error: Access of undefined property WildcardFilterEditor in package com.iwobanas.controls.dataGridClasses.filterEditors.
[compc] filterEditor = new ClassFactory(com.iwobanas.controls.dataGridClasses.filterEditors.WildcardFilterEditor);
[compc] ^
[compc] E:\flexspace\imanager\framework\src\com\iwobanas\controls\dataGridClasses\MDataGridColumn.as(24): col: 60 Error: Definition com.iwobanas.controls.dataGridClasses.filterEditors:WildcardFilterEditor could not be found.
[compc] import com.iwobanas.controls.dataGridClasses.filterEditors.WildcardFilterEditor;
[compc] ^
[compc] E:\flexspace\imanager\framework\src\org\syspire\erp\component\tooltip\components\ExtendedToolTip.as(3): col: 48 Error: Definition org.syspire.erp.component.tooltip.skins:ExtendedToolTipSkin could not be found.
[compc] import org.syspire.erp.component.tooltip.skins.ExtendedToolTipSkin;
[compc] ^
[compc] E:\flexspace\imanager\framework\src\org\astrika\shared\components\gridSearch\view\SearchDatePopup.mxml(14): Error: Type was not found or was not a compile-time constant: SearchDateView.
[compc] <gridSearch:SearchDateView id="searchDateView"/>
...similar errors...
BUILD FAILED
E:\flexspace\imanager\commons\build.xml:17: The following error occurred while executing this line:
E:\flexspace\imanager\framework\build.xml:17: compc task failed
Total time: 4 seconds
这里出了什么问题?
由于
修改
根据要求,这是配置转储:
使用Flash Builder构建框架:http://pastebin.com/kLai6j7X
使用ANT进行框架构建:http://pastebin.com/FGHBAXZX
使用ANT从公共区调用的框架构建:(这与前一个转储相同)
更新
我最后只是更改了构建文件的结构以消除<ant>
调用。我现在如何为所有项目创建一个build.xml,将所有项目都作为目标。不漂亮,但它对我有用。
答案 0 :(得分:0)
这有点偏离主题,但我发现Ant在管理Flex项目的构建方面做得不好,特别是当你有依赖项时。
您是否考虑过将Maven与FlexMojos一起使用? Adobe发布了关于这个伟大工具的a series of articles。很推荐!
答案 1 :(得分:0)
你绝对可以尝试的一件事是将taskdef移动到目标中,至少可以摆脱&#34;试图覆盖旧任务的定义&#34;警告。