0

我有一个名为 flex 的项目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>

从公共构建文件中调用<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 从 commons 调用的框架构建:(这与之前的转储相同)

更新 我最终只是更改了构建文件的结构以消除<ant>调用。我现在如何为所有项目创建一个 build.xml,将所有目标都包含在其中。不漂亮,但它对我有用。

4

2 回答 2

0

您绝对可以尝试的一件事是将 taskdef 移动到目标中,至少这将摆脱“尝试覆盖任务的旧定义”警告。

于 2014-04-09T02:20:42.397 回答
0

这有点离题,但我发现 Ant 在管理 Flex 项目的构建方面做得不好,尤其是当你有依赖项时。

您是否考虑过将 Maven 与FlexMojos一起使用?Adobe 发布了一系列关于这个伟大工具的文章。非常推荐!

于 2012-11-02T12:31:10.407 回答