Skip to main content
Henrik_LSP
Participant
November 27, 2014
Question

FlexUnit ant task fails with AIR SDK 15

  • November 27, 2014
  • 2 replies
  • 2101 views

I have an ant script that, among other things, runs FlexUnit. This runs on a TeamCity build server and worked until we upgraded to AIR SDK 15.

The FlexUnit part looks like this:

<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

<taskdef name="flexunit" classname="org.flexunit.ant.tasks.FlexUnitTask" classpath="${LIBRARIES_PATH}/libs/flexUnitTasks-4.1.0.jar" />

<property name="testpath" value="${LIBRARIES_PATH}/${libraryName}/test"/>

...

        <if>

            <available file="${testpath}"/>

            <then>

                <echo message="Run unit tests: ${testpath}" />

                <flexunit

                    workingDir="${BIN_OUTPUT_DIR}/bin_temp"

                    haltonfailure="true"

                    localTrusted="false"

                    verbose="false" >

                  <source dir="${LIBRARIES_PATH}/${libraryName}/src" />

                  <testSource dir="${testpath}" casesensitive="no">

                     <include name="**/Test*.as" />

                  </testSource>

                  <library dir="${LIBRARIES_PATH}/libs" />

                </flexunit>

            </then>

            <else>

                <echo message="No unit tests found at ${testpath}" />

            </else>

        </if>

Now it fails with the following error: (there is a lot of flexunit output before this that I have not included.)

[flexunit] Loaded from D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\flexUnitTasks-4.1.0.jar org/flexunit/ant/tasks/Compilation.class

[11:25:05][flexunit] Class org.flexunit.ant.tasks.Compilation loaded from ant loader (parentFirst)
[11:25:05][flexunit] Class java.lang.Exception loaded from parent loader (parentFirst)
[11:25:05][flexunit] Class org.apache.tools.ant.types.Resource loaded from parent loader (parentFirst)
[11:25:05][flexunit] Class org.apache.tools.ant.types.resources.URLResource loaded from parent loader (parentFirst)
[11:25:05][flexunit] Class org.apache.tools.ant.types.resources.FileResource loaded from parent loader (parentFirst)

[flexunit] Using the following settings for compilation:

[11:25:05][flexunit] FLEX_HOME:
[11:25:05][flexunit] player: [flash]
[11:25:05][flexunit] sourceDirectories: ["D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\Events\src"]
[11:25:05][flexunit] testSourceDirectories: ["D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\Events\test"]
[11:25:05][flexunit] libraries: ["D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\CanOpenUrl.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\Hurlant.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\Igniterealtime.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\Wirelust.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\blooddy_crypto.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\feathers-v1.3.0.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\flexunit-4.1.0.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\flexunit-cilistener-4.1.0.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\greensock_12_1_5.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\lccs.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\robotlegs-framework-v2.1.0.swc","D:\TeamCity\buildAgent\work\dd6510b0af11ae6c\GlobalShared\libs\starling-v1.4.1.swc"]
[11:25:05][flexunit] Class org.apache.tools.ant.taskdefs.Java loaded from parent loader (parentFirst)
[11:25:05][flexunit] Class org.apache.tools.ant.types.Commandline$Argument loaded from parent loader (parentFirst)
[11:25:05][flexunit] Execute:Java13CommandLauncher: Executing 'D:\TeamCity\jre\bin\java.exe' with arguments: '-jar' 'D:\sdk\air_sdk_15_0\lib\mxmlc.jar' '--version' The ' characters around the executable and arguments are not part of the command.
[11:25:06][flexunit] Setting project property: SDK_VERSION -> Error: Unable to access jarfile D:\sdk\air_sdk_15_0\lib\mxmlc.jar
[11:25:06][flexunit] Could not create test runner from template.
[11:25:06][antcall] The following error occurred while executing this line: D:\MSPBuildTools\build_scripts\build_global_shared_libraries.xml:104: Could not create test runner from template.

It seems to fail, because it is looking for mxmlc.jar, which does not exist. AIR SDK 15 replaces it with mxmlc-cli.jar. I have looked for documentation on the difference between these two files, but could find none.
Does someone know what could be the root cause of this problem or how to fix it?

This topic has been closed for replies.

2 replies

Henrik_LSP
Participant
February 6, 2015

Is there no-one else using FlexUnit with AIR SDK 15 or later?

Henrik_LSP
Participant
December 17, 2014

I still have not been able to get FlexUnit running with AIR SDK 15. But I found a workaround:

Compile the source code with SDK 15 into swc files.

Set FlexUnit to use SDK 4.

Do not include source code in the FlexUnit Ant task.

Include the swc files in stead by adding another library dir parameter to the flexunit call.