An introduction to Maven and Flexmojos

27 07 2011

I presented an introduction to Maven and Flexmojos last night. The talk is a varient of the one I will be giving at FITC@MAX this year.

The talk starts off discussing Maven, the hierarchical structure of projects, POMs and the build life cycle. We then discuss the Flexmojos plugin to build Flex applications. After that, we talk about repositories – both local and remote, and discuss how Nexus can perform the role of remote repository within your organisation, proxying to others on the web.

We work through 6 main examples. All code is on Github.

  1. The simplest application possible – a custom Hello World that uses the latest Flexmojos (4.0-RC1) and Flex SDK (4.5.1)
  2. Adding automated unit tests to the build
  3. Installing custom dependencies that aren’t hosted on the web
  4. Using the Flasbuilder goal to create a Flashbuilder project from a build script
  5. Starting Flex applications from the supported archetypes (templates)
  6. A basic application that has custom dependencies and its own class library.

Source files: https://github.com/justinjmoses/flexmojos-introduction


Actions

Information

14 responses

30 07 2011
neosavvy

Good for you there buddy – glad to see you are taking the time to share your work with others!

Hopefully some of my posts were helpful or are helpful to your readers.
http://blog.neosavvy.com/wordpress/?cat=4

31 07 2011
Simon

Great, thanks a lot for sharing!

Have you also created a working example with Flexmojos, Flex SDK 4.5.1 to build an AIR application?

31 07 2011
Justin J. Moses

Simon,

No I haven’t as yet. One of the first things I’d say though is to ensure you’ve set the “swfVersion” parameter. The newest builds of Flex 4.5 and 4.5.1 require the “swfVersion” set to 12. (Relates to the Flash Player

eg. in your pom.xmml


<configuration>
<swfVersion>12</swfVersion>
</configuration>

See the details here:
https://repository.sonatype.org/content/sites/maven-sites/flexmojos/4.0-RC1/compile-swf-mojo.html#swfVersion

2 08 2011
Michel Boudreau

Hey bud, you might want to update your example to use flexmojos 4.0-SNAPSHOT as RC1 doesn’t seem to be live anymore: https://repository.sonatype.org/content/groups/flexgroup/org/sonatype/flexmojos/flexmojos-maven-plugin/

2 08 2011
Justin J. Moses

Hey Michel,

It’s there, just under a different root folder:

https://repository.sonatype.org/content/repositories/maven-sites/flexmojos/

You can also see it in their Nexus: https://repository.sonatype.org (Search for flexmojos-maven-plugin), although for some reason Nexus thinks the ‘4.0-pre-alpha-1’ is the latest.

2 08 2011
Michel Boudreau

Ah nice, thanks.

21 09 2011
Krešimir Popović

Thank you!

4 02 2012
viswakarma

Hi Justin
I am trying to get your examples to run. I am a newbie to all this.
I am having issues in running even the simple application since there are issues when it runs in the flash player.

An ActionScript error has occurred:
VerifyError: Error #1053: Illegal override of z in mx.core.UIComponent.
It starts with that error and lot more no found after that.

If i skip the unit tests then the SWF also will not work in the flash player later.

i am using flash player debugger 10.0.45.2

flex 4.5.1.21238
flexmojos 4.0-RC2

Please help me out since i am struck here and not able to run any of your sample apps

4 02 2012
Justin J. Moses

Hey,

The Flash Player version is what is getting you. Flex 4.5.1 requires 10.2 and 4.5 requires at least 10.1. I’d say just i upgrade to flash player 11, but I suspect you have to write an application that supports FP 10.0? If so, you’ll have to downgrade to Flex 4.1.0.16076.

Good luck,
Justin

30 03 2012
lingpriya

Hi Justin,

I’m facing a similar problem like viswakarma. I have a FlashPlayer 11.1.102.63
(my browser test says that) and I have set the path variable to point to
FlashUtil64_11_1_102_ActiveX.exe directory which is the closest i get to when i search for the FlashPlayer in my m/c . I get the error below,when running your second example FlexUnitTests (I changed the version to 4.0-rc1 for flexuint)

Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-RC2:test-run (default-test-run) on project flexmojos-unittests: Failed to launch Flash Player. Probably java was not able to find flashplayer.
Make sure flashplayer is available on PATH
or use -DflashPlayer.command=${flashplayer executable}
Read more at: https://docs.sonatype.org/display/FLEXMOJOS/Running+unit+tests: Cannot run program “FlashPlayer.exe”: CreateProcess error=2, The system cannot find the file specified
-> [Help 1]

1) why is it looking for FlashPlayer 10.2 version ,when there is no mention of which FlashPlayer version to look for?

Please direct me in resolving the issue.Many Thanks–Priya

30 03 2012
Justin J. Moses

hey priya,

i’m assuming you are on Windows – let me know if you’re not. because then you should be using a different executable below.

it is simply looking for “FlashPlayer.exe” – if you type and run “FlashPlayer” from inside the command prompt does it start up the standalone player?

ignore anything to do with the flash player version – that is older documentation – Flexmojos will look for “FlashPlayer.exe” regardless of version.

30 03 2012
lingpriya

Hi Justin,

I’m on a windows box and I’m at loose when I see two different behaviours,when running the unit test in two different boxes,one with FlashPlayer 11 (home pc)and one with Flash Player 10.3.181.26 (at work). With the former, its looking for FlashPlayer.exe and the later looking for flashplayer-10.2.exe, when running the maven goal. Should I rename the file to whatever it is looking for (I see the FlashPlayer in the following location “C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\player\win” ) or what should I change in the pom.xml , to make it look for FlashPlayer.exe

flexmojos-maven-plugin
4.0-RC2

flex-framework
4.5.1.21328

flexunit
4.0-rc-1

Many Thanks .. Priya

30 03 2012
lingpriya

Forgot to mention ,when i type FlashPlayer.exe in any command prompt the standaloneplayer comes up ,but the issue now is its looking for flashplayer-10.2.exe

30 03 2012
lingpriya

I got it resolved.I downloaded the Fl*_sa_debug.exe and renamed to FlashPlayer.exe and was able to run the unit test. Thanks again. Priya

Leave a comment