Adding Libaries and Fonts to Your ActionScript Maven Build

Few weeks ago I’ve covered ActionScript build automation with Maven and FlexMojos here. Today I’m going to talk about adding libraries (SWC, ANEs) and fonts to your ActionScript maven build. I will also cover builds for Adobe Air and Android packages.

I will start off with embedding fonts. The normal way to do it in ActionScript is like this

[Embed(source="resources/Tauri.ttf", fontFamily="Tauri", mimeType = "application/x-font", embedAsCFF="false")]

In order to do it in FlexMojos, you need to add the following in the plugin configuration section in the pom.xml

<fonts>
	<managers>
		<manager>flash.fonts.AFEFontManager</manager>
		<manager>flash.fonts.JREFontManager</manager>
		<manager>flash.fonts.BatikFontManager</manager>
		<manager>flash.fonts.CFFFontManager</manager>
	</managers>
</fonts>

Please select only one of the font managers. I’ve had most success with AFEFontManager.

Next on the agenda is adding libraries (dependencies) so that maven recognizes them automatically. The process is the same for both SWC and ANE files. The first thing is to install the file as using Maven in the local repository.

mvn install:install-file -Dfile=someFile.swc -DgroupId=com.company -DartifactId=applicationName -Dversion=1.0 -Dpackaging=swc

Similarly for an ane file, change the packaging from SWC to ANE.

After installing them in the Maven repository they can simply be referenced in the dependencies section like this

<dependency>
	<groupId>com.company</groupId>
	<artifactId>applicationName</artifactId>
	<version>1.0</version>
	<type>swc</type>
</dependency>

For the ANE change the type to ANE.

In my next blog post I will detail how to extend your ActionScript Maven build to get Adobe Air and Android packages.

Leave a Reply

Your email address will not be published. Required fields are marked *