Flex-Mojos keepAs3Metadatas Option to Apply keep-as3-metadata Compiler Option

If you use the flex-mojos plugin to compile flex code in a maven project, you might have the need to apply the -compiler.keep-as3-metadata option to the compiler, like I did.

The documentation for compile-swf mojo says to put something like the following, into the configuration element:

<keepAs3Metadatas>
   <metadata>Bindable</metadata>
   <metadata>Events</metadata>
</keepAs3Metadatas>

but that failed horribly. It seems like maven tries to instantiate a Metadata class (which I think the mojo use for applying author metadata to the flash), for each metadata element, which is wrong (and fails the build). Well, the solution was simple, name it something else, like here, where I name it name:

  <build>
    <plugins>
      <plugin>
        <groupId>info.flex-mojos</groupId>
        <artifactId>flex-compiler-mojo</artifactId>
        <extensions>true</extensions>
        <configuration>
          <keepAs3Metadatas>
            <name>ConditionalShow</name>
          </keepAs3Metadatas>
        </configuration>
      </plugin>
    </plugins>
  </build>

December 29, 2008 В· polesen В· One Comment
Tags: ,  В· Posted in: Rich Internet Applications

One Response

  1. thegoldenmule - June 13, 2011

    I know this is an old post but… that’s not why. Your first solution is failing because those are native metadatas, which are always going to be honored by the compiler. keepAs3Metadatas is only for your custom metadata, so that’s why your second solution works.

Leave a Reply