apache-flexmxmlc

Build flex library using mxmlc


I want to build a flex library project directly through the mxmlc compiler. My library has one .as file and it is under a package call com.test

package com.test { public class Main {  public function Main(){...

I run the following command on the cmd

D:\4.11.0\bin\mxmlc D:\TestLibrary\src\com\test\Main.as

But it gives me the following error

Error: A file found in a source-path must have the same package structure '', as the definition's package, 'com.test'

If I remove the package definition from the script as follows, it works.

package { public class Main { ...

My question is why this happen and how to fix it?


Solution

  • You need to additionally tell the compiler the root of your sources:

    mxmlc D:\TestLibrary\src\com\test\Main.as -source-path D:\TestLibrary\src\
    

    by providing the "source-path" property you are telling the compiler where the root is and releative from that it now should know that com.test.Main is the relative path to your class.