davidcognite

Developing an Alfresco AMP against a specific Aikau version

Blog Post created by davidcognite Employee on Feb 18, 2015

If you're developing an Alfresco extension that works against Share, you'll probably find that using Aikau streamlines the process. That's exactly what we're doing in the Records Management (or RM) team.

 

RM is the largest Alfresco extension developed by in-house Alfresco engineers, so it proves a good testing ground for extension methods. We've found Aikau helps a lot with Share extensions: the latest release makes use of it in some areas and we're looking to extend its use for the next release.

 

Now that Aikau is a separate project with an aggressive (weekly) release cycle it would be quite easy to miss out on the latest features and bug fixes if an Alfresco add on was dependent upon the version of Aikau that was bundled with Alfresco, luckily it's very easy to specify a newer version for your AMP to use.

 

The Aikau team have committed to ensuring that their releases are backwards compatible from this point (Alfresco 5.0.1) onwards (and have tests to verify it), so we don't need to worry about breaking Share by upgrading the Aikau lib.

 

As of 5.0.1, Aikau is defined as an external dependency within the Share pom.xml. It then ends up as a JAR in the WEB-INF/libs directory of the share.war, so that's where our AMP needs to place the newer version.


Step one of the process for including a newer version of Aikau is to update the dependency within our project's pom.xml:

 

 

      <dependency>
         <groupId>org.alfresco</groupId>
         <artifactId>aikau</artifactId>
         <version>1.0.5</version>

         <!-- Exclude Aikau's dependency from the AMP -->
         <exclusions>
            <exclusion>
               <groupId>*</groupId>
               <artifactId>*</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

 

Note: you need to make sure that the alfresco-maven-plugin you use to generate the AMP is configured to includeDependencies, as we want to ensure that the Aikau JAR ends up in the libs directory of the AMP and therefore in the WEB-INF/libs directory of the Share war when installed.

That's it, there is no step two. All the configuration is cleverly handled by an extension module that Aikau supplies (which assumes that you've got auto-deploy turned on - if not you'll need to manually enable this extension module). If you've got multiple AMPs that require different versions of Aikau, then the one with the highest version number wins out (due to the auto-deploy-index in the extension module).

To check which Aikau version is present inside a running Share instance, either:

    • Load up a page and check the window.dojoConfig JS object, the packages object contains a list of all defined AMD package roots - the location for the alfresco/ package contains the path to the JAR (located within the WEB-INF/lib/)

      window.dojoConfig
    • Check the module deployment page to verify that the Aikau extension for your overridden Aikau version has been applied
      module deployment page

Outcomes