Writing and Debugging a Maven Mojo

I set up my environment to develop a mojo and be able to debug it on intellij (version 13 at the time writing).

Here’s a very lean list of the things you need to do the job:

create the mojo project from org.apache.maven.archetypes:maven-archetype-mojo

  1. create your mojo entry point, it’s just a java class extending AbstractMojo and override execute() method
  2. comment your mojo class with a javadoc “@goal whatever” and “@phase whateverphase” . Those apparently useless comments are actually used to determine which goal and phase are associated with your mojo. You can ignore @phase and determine that later, but @goal (AFAIK) is mandatory
  3. create a test project that uses your brand new mojo as a plugin, specify an execution and a goal to be invoked (the same goal you wrote in the comment at step 3). At this point you can specify the phase you want your mojo to be executed into if you didn’t specify it in your comment.
  4. mvn install your mojo
  5. mvnDebug install (or specify the phase you need) your test project. mvnDebug will listen on port 8000 on localhost for incoming debug connections.
  6. in intellij, create a “Remote” run\debug configuration and change the settings as follows:
    1. transport: socket
    2. debugger mode: attach
    3. host: localhost
    4. port: 8000
  7. set a breakpoint on execute() and start debugging your mojo!


Good to knows:

  1. you can map a (private) variable of your mojo to a configuration parameter on your pom, just decorate your private variable with a javadoc comment such as @parameter alias=”whateverParam” (this will map <configuration><whatever> to the private String(?) decorated with that comment.
  2. you can map whatever class to manage configuration parameters of your mojo: just create a class and make it implement java.io.Serializable. The properties of the class are resolved and populated by reflection (it’s a very useful if you need nested objects as configuration!!!)
  3. more to come… 🙂
Mac, Tutorials, Uncategorized

How to make a VM boot your OSX partition from Windows

Let’s say you own a mac and you installed Windows into a second partition of your hard drive via Boot Camp, and let’s say you need to access your alternate OS from its partition often but you won’t reboot everytime.
Several softwares enable you to do that using OSX as your main OS: Parallels, VMware Fusion, and VirtualBox are just the most known guys out there and all of them have options to boot a vm from a physical installation of Windows.

But what if you are in the opposite situation and you’re using Windows as the main OS and want to boot a vm from the OSX installed in the main partition of your hard drive?
Here’s how I made it possible with VMware Fusion 6 and VMware Player 6 for Windows.

OSX partition running on Winows 7 on VMware Player

NOTE: First of all I’ve to say this is a hack, not something I’d recommend for daily work, moreover remember that there’s your physical installation of OSX inside that vm so don’t mess anything up otherwise you’ll have to fix them the next time you’re booting to OSX.

These are the steps to follow to create a VM booting from your physical OSX installation:

  1. Boot your OSX and install VMware Fusion 6 (you don’t need the pro version for this) on OSX
  2. Create an empty OSX VM. Don’t use “Install OSX from recovery partition”, you don’t need a new installation, you’re going to make the VM boot your physical installation, so just create a custom VM. In my case I created it for Mavericks (10.9) and I really don’t know if it works with other versions of OSX.
  3. Open Terminal and type “diskutil list” in order to get the list of your partitions, you should get something like this.
    Terminal diskutil list
    in the picture you can see that OSX is installed in partition 2 of disk0 (it should be the same for you, if it’s not just take a note of your partition number and use that instead)
  4. Reboot to your Boot Camp Windows installation and install VMware Player 6 (again, you don’t need any pro version, moreover the player is free for non commercial usage)
  5. Open the blank OSX VM settings with VMware Player (Fusion should have created a .vmwarevm file that Windows sees as a folder, inside that folder there’s the actual VM file which has a .vmx extension)
  6. Remove the current Hard Disk from the settings (the blank VM should have a SATA virtual disk sized 40gb) and replace it with a physical disk, here’s the steps to follow:
    1. Click the “Add” button at the bottom of the hardware tab in Virtual Machine Settings dialog and click next
    2. Select Hard Disk from the hardware types list and click next
    3. Select IDE from the virtual disk type options and click next
    4. Select Use a physical disk (yes, for advanced users) and click next
    5. Select Use individual partitions and click next
    6. Now, remember the partition you listed on the terminal when you booted on Mac? Select the partition where your OSX is installed, the partition file system should be Apple HFS… and click next
    7. Choose a name to save that virtual disk configuration and click finish!
  7. You should now have a configuration similar to this

Now your VM is ready to boot your OSX partition! Just tweak your VM RAM and CPUs to make it usable.


  1. VMware tools won’t install, at least it won’t for me, so the drag n drop file feature won’t work
  2. Bootcamp drive will not be accessible from OSX VM because in use by the running Windows instance, same will happen for every volume you mounted in Windows, such as CD-rom and USB keys
  3. I don’t know if it matters in any way but I’ve installed a driver to enable writing HFS+ filesystem from Windows (otherwise it was read only). The driver I use is Paragon HFS for Windows.

Once more, this is a hack and I don’t suggest you to use this approach for daily or frequent usage.


I don’t assure you it works in every machine nor I tried in other machines, it works on mine which is a MBP 6,1 (mid 2010).


Good tutorial on how to install Apache Flex 4.8.0 SDK in Flash Builder

Luca Mezzalira

In this post I’ll explain in an easy step by step tutorial how to install Apache Flex 4.8.0 in Flash Builder, I know that it’s not rocket science but maybe newbie developers could need more information to start play with new SDK.

The new SDK is more or less the same of 4.6 but under Apache flag, like you can read at Spoon website, but we hope people behind the project could give us new opportunities for our RIAs and Mobile projects.

So let’s start!

First of all download Apache Flex 4.8.0 binaries for your operating system (in my case OS X), keep attention, you need the binaries release not the source one.
After unzip the downloaded file create a folder called 4.8.0 in /Applications/Flash Builder 4.5/sdks

Then download playerglobal.swc for Flash Player 11 on Adobe website.

Save it in /Applications/Adobe Flash Builder 4.5/sdks/4.8.0/frameworks/libs (it could be better create a folder…

View original post 287 more words

ActionScript 3, Community, Speaking, Tutorials, Uncategorized

FlashCamp Milan 2011 – Garbage Collection in the Flash Platform

This post is to summarize my session at the FlashCamp.

Here’s the preso: (italian only)

and here are the examples shown during the session:

Garbage collector in action:
this example shows the memory allocation behavior. Take a look to the saw tooth yellow line in the graph.

Weak vs Strong references:
two examples to show the difference between weak and strong references: basically weak do not increment reference count, strong do that.
If you store keys in a dictionary using weak references your keys are getting cleaned by the garbage collector ( example )
otherwise the GC doesn’t clean your keys ( example ).

Blitting in order to ease the GC:
The GC iterates through each reachable node starting from the roots, one of these roots is the displaylist. So in order to ease the GC work we could flatten the whole displaylist to one bitmap by leveraging the usage of the blitting technique.
These examples display about 1000 new objects drawn each frame by using the display list ( example ) or the blitting technique ( example ). The difference in performances are not only due to the different compositing techniques (built in compositing when using the displaylist VS manual compositing when using the blitting technique ) but also to the lower number of instances to be collected by the GC.

NOTE: both examples are very cpu intensive

Don’t let the GC start by using the memory pool technique:
The GC freezes the program when freeing the memory. The memory pool technique consists in reusing the instances of your objects preventing the GC to identify those objects as garbage.
This makes your app memory utilization stable (a straight yellow line ) and removes every glitch due to the garbage collection.
These examples show a simple particle fountain implemented by leveraging the memory pool technique ( example ) or not ( example ).

here’s the source, it’s not the best commented nor the best implemented files out there, but just take a look at them to have a full comprehension of what’s going on 😉

If you need further help, please comment this post and let me know.

PS: obviously mario copyright is property of nintendo 🙂

ActionScript 3, Community, Flash, Speaking, Uncategorized

Flash Camp Milano 2011 – the day after

Yesterday it has been a great day!
Yesterday we had the FlashCamp here in Milan, hosted by WhyMCA mobile conference (thanks guys).

Flash Camp at WhyMCA

Lots of fun, lots of people (450 nerds) from the most different beliefs (html5ers, javascripters, objective-Cers, androiders, whateverers :)), a great happening to spread the word about what you can do with the flash platform and how it can ease your work when deploying on mobile devices.
Thanks to Adobe we even had a welcome guest: Mihai Corlan, who presented very cool new stuff putting his hands on Flex Builder 4.5 and the Flex Hero SDK.
Moreover it has been totally the best possible way to meet other people from the community of Milan, TheFlashMind, and to spread the word about our cool AUG 🙂

I really enjoyed the FlashCamp, it has been a pretty unique conference in Italy and it has been even more successful than we expected.
As the camp was in “Eataly” we had an Eatalian FlashCamp party at the end, a cool way to make developers meet each other and to make them drunk 🙂
Someone even twitted that it was the best part of the FlashCamp in Milan 🙂

Last but not least: my friend Luca already uploaded some pics to his flickr account.

See you at the next camp 😉


My FOTB '09 Schedule

Flash on the beach is each day closer and I started to plan my own schedule.
Each choice has been quite hard because of the high quality the conference is offering, the good thing is that even if I’m not 100% convinced to be attending some sessions I’m sure that I can switch to another one with the same or even higher quality 🙂

papervision3D workshop by seb lee-delisle

Richard exposes all! – Richard Galvan
Casual game architecture – Keith Peters
Visualizing the voice – Chuck Freedman
Who’s a bright spark then! – Mike Jones
Cybernetic art revsited – Dr. Woohoo!
Telling Stories – Hillman Curtis
Epiphany – Joel Gethin Lewis

3 minute wonders – many (looking forward to Michiel van der Ros 3D optimization for MMOs)
Quick as a Flash – Grant Skinner
Leaving the sandbox – Joa Ebert
Application Frameworks – Richard Lord
More than bending pixels – Paul Burnett
Unconventional Webapps – Des Traynor + Eoghan McCabe
Choose your own adventure – Craig Swann

Play with vectors – Koen de Weggheleire
Connecting the dots – Mario Klingemann
Work/Play – Seb Lee-Delisle
Flashed Fashion – Andy Mcdonald
Research realtime graphics – Ralph Hauwert
Space – Joshua Davis

I’m getting in Brighton on saturday 19th, you’re allowed to poke me 🙂