Deploying Alfresco extensions to Maven Central repository

During Beecon 2016 I was approached by Bindu Wavell and others who told me that it would be really helpful to have the Javascript Console, as the most used Alfresco extension, in a Maven Repository repository to easily integrate it into custom Alfresco installations.

At Beecon we were in the lucky situation that we could also involve Ole and Samuel and Richard as Alfresco employees into the topic but we decided quickly that it would not be feasible at the moment to bring the artifacts in Alfresco’s maven repository as there is currently no process to deploy external projects to that repository.

Therefore I spent a few hours during the conference and investigated on how to get the Javascript Console into the Maven Central repository. I think this is the best place to host any open source extensions for Alfresco since it is readily available in any Maven installation out of the box. The only other extension that has done that before (to my knowledge) is uploader-plus — that is where I took some inspiration.

Since I believe more Alfresco extensions should got this way here is the process to get any artifacts hosted on Maven Central:

  • Register at the Sonatype Jira and request a repository hosting by creating a ticket
  • When your account is set up you can later use these Jira credentials for the maven artifact upload to Nexus as well
  • You need to follow a number of policies in your project to get through the staging process at Sonatype:
  • Add a license descriptor to the POM, you need an open source license of course
  • Add SCM hosting and project urls as well as maintainer information
  • Set up GPG to allow code signing (your public GPG key needs to be registered with a public key server)
  • Set up a maven deploy plugin, I opted for the sonatype deploy plugin as it is slightly easier to manage as the maven release plugin. (see javascript console POM for an example)
  • Upload the artifacts using mvn deploy -Prelease (I used a release profile to be able to control the code signing)
  • When you upload for the first time you need to tell Sonatype (by commenting on the Jira ticket) to set up a sync job with maven central.

After one or two hours the artifacts from are available on maven central and through the search. You might need to add <type>amp</type> to the dependency instructions displayed on the Maven search site.

To set this whole process up you might need a few hours before everything is working. I suggest looking at these links for more information:

Some additional remarks:

  • You can update the artifacts of an existing version (for me it took about an hour to synchronize). Usually you should not do that as consumers might not get the updates.
  • You can also use SNAPSHOT versions but they will not upload to Maven Central so you would need to add the repository to your POM for those to be used.

If you have any questions or remarks leave a comment or reach out on twitter.

Like what you read? Give Florian Maul a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.