Flex ant任务问题

时间:2009-11-05 18:45:31

标签: flex ant build

当我尝试构建一个使用Flex的项目,并且Flex SDK位于一个驱动器上而项目文件位于另一个驱动器上时,我在ant中出现以下错误:

[mxmlc] java.lang.NoClassDefFoundError: flex2/tools/Compiler
[mxmlc] Exception in thread "main"

这似乎是Flex mxmlc ant任务的一个问题。有谁知道这个的根本原因?如果我将Flex SDK移动到项目文件夹但是我不喜欢那样的hack ......它会起作用。

详细模式下的Ant给出:

compile.main:
dropping E:\c from path as it doesn't exist
dropping E:\programs\flex-sdk\lib\mxmlc.jar from path as it doesn't exist
    [mxmlc] java.lang.NoClassDefFoundError: flex2/tools/Compiler
    [mxmlc] Exception in thread "main" 
  [antcall] Exiting E:\svn\trunk\dev\modules\web\webapps\lpjserver\lpjserver-build.xml.

BUILD FAILED
E:\svn\trunk\dev\modules\web\webapps\lpjserver\lpjserver-build.xml:379: The following error occurred while executing this line:
E:\svn\trunk\dev\modules\web\webapps\lpjserver\lpjserver-build.xml:199: mxmlc task failed.
    at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: E:\svn\trunk\dev\modules\web\webapps\lpjserver\lpjserver-build.xml:199: mxmlc task failed.
    at flex.ant.FlexTask.executeOutOfProcess(FlexTask.java:253)
    at flex.ant.FlexTask.execute(FlexTask.java:223)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    ... 17 more
--- Nested Exception ---
E:\svn\trunk\dev\modules\web\webapps\lpjserver\lpjserver-build.xml:199: mxmlc task failed.
    at flex.ant.FlexTask.executeOutOfProcess(FlexTask.java:253)
    at flex.ant.FlexTask.execute(FlexTask.java:223)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
    at org.apache.tools.ant.Main.runBuild(Main.java:758)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

4 个答案:

答案 0 :(得分:1)

您是否已将flexTasks.jar放入ant安装的lib文件夹中?

就我而言,我已将D:\Flex_sdk_3.3.0\ant\lib\flexTasks.jar复制到D:\apache-ant-1.7.1\lib\

答案 1 :(得分:1)

某处有一条路径,前面没有驱动器号。所以当你在'正确'的驱动器上时它会起作用,但不是这样。

我发现了this博客帖子 - 在文本中搜索MXMLC= - 有人找到了一个解决Mac安装问题的解决方案。您可能能够适应您的情况。 (看起来可能在安装和配置flex mxmlc编译器时,它不一定包括所需的驱动器号。)

不是移动或复制jar,也许你可以在你的构建中添加驱动器号作为属性的完整路径,然后将其附加到类路径。

答案 2 :(得分:1)

我确定这实际上是flex ant任务中的一个错误。 FlexTask.java没有正确路径在Windows机器上的多个驱动器上工作。

答案 3 :(得分:0)

将Flex sdk / x.x文件夹复制到与源相同的驱动器,调整flex.sdk.home ant变量并重建。