Share Extensions Build Script

Blog Post created by wabson Employee on Feb 22, 2010
Update, 4th May 2011: The latest version of the build script and sample Eclipse project is now hosted on Share Extras. For more information please see the Sample Project page.

With Kev's recent SpringSurf changes in the 3.3 code line, Share extensions are now much easier to deploy as shared libraries. However, it's still up to individual developers to set up their own project structure and to package this up as a JAR.

So, to build the latest Site Tags dashlet using this method I put together an Ant build script, which hopefully will be useful to others.

As well as building a JAR it also supports the unofficial ZIP structure that we'd used previously to package up sample dashlets, in addition to the AMP format that we use for the more complex DoD extensions for Share.

The build script assumes a standard Alfresco project layout as follows

 /config - all web-tier configuration files, with a top-level 'alfresco' package

/web - all static resources, e.g. CSS and JS files

You can use the build script with your existing projects if they fit this structure, or you can use my own zipped-up site tags dashlet project as a template for your own. This should import into a fresh Eclipse project but you could extract it elsewhere.

Once your project is set up and you're ready to package up your extension, you can run the following command to build the JAR.

 ant -Djar.name=my-sample-project.jar package-jar

To package up a ZIP or AMP, substitute 'jar' in the parameters to 'zip' or 'acp'. Easy, eh?