Alfresco Maven

June 14
blog author

Appno Blogger

Appnovation Coop

In November 2012 Alfresco released a fully new version of its Maven support through the Maven Alfresco SDK 1.0. Maven can usefully replace Ant to build your Java application or Alfresco customization. Although, it’s can be seen as a substitute, it works at a higher level, and is useful to manage the whole lifecycle of the project, not only the build phase. If you haven’t have the opportunity to work with Maven already, this is a good starting point : http://maven.apache.org/what-is-maven.html Until now, most Alfresco customizations were packaged by using Ant. Even if this is a flexible tool, it requires the developer to write and maintain Ant tasks, which can be error prone. Maven has the advantage to provide an organization and a structure layer. What does the SDK includes ? The Alfresco SDK parent POM The Alfresco Maven Plugin The Alfresco Artifacts repository 2 Archetypes : AMP and All-in-one What is the advantages of Maven vs Ant for building Alfresco modules? With Maven, the developer don’t have to worry about the building tasks for the module. He is able to manage the full project lifecycle by setting the different plugin configurations and dependencies for the module in the POM file. This is quicker and less error prone. As unit testing is integrated in the default lifecycle, it enables agile development practices, like TDD. Why is there 2 archetypes available ? While the AMP archetype is a basic project template dedicated to create a simple Alfresco Repository / Share module, the All-in-one archetype is a multi-module project that give the ability to customize and run the full Alfresco platform. It doesn’t require any download and provide a good starting point for full-blown Alfresco project. With Jetty and H2 DB embedded, you can run the full Alfresco suite self-contained from your IDE. What are the prerequisites ? Maven usage is possible from Alfresco Community 4.2b+ and Enterprise 4.1.2+ What advantages is there to use Maven at the development stage ? As the whole dependencies are managed by Maven, Alfresco and third party library sources are available automatically without having to manually download them. In addition, debugging and unit testing is easier and integrated. In conclusion, Alfresco Maven is a great improvement to manage the full lifecycle of your Alfresco project. It enables you to work with Alfresco within few minutes, without having to download and install the full Alfresco platform. It automatically run your unit tests, and package reliable enterprise Alfresco module. Here are some useful places where you can find more information about Alfresco Maven : https://artifacts.alfresco.com/nexus/content/repositories/alfresco-docs/alfresco-lifecycle-aggregator/latest/index.html