Alfresco: How to write a simple Java based Alfresco web script?

If you want to develop a new feature for Alfresco best way is WebScript! Let’s start with a simple Alfresco web script. First, you need to create an Alfresco AMP maven project using archetype. In this example, I’ll use the latest alfresco version 5.0.

First I generated Alfresco All-in-One AMP. (Please refer my blog post on generating AMP projects.)

If you go through the files structure which is generated, you will find out a sample web script. It is a JavaScript-based WebScript. By this example, I’m going to explain how to write a simple Java-based Hello World web script.




Create the above files in below locations of your maven project.

Use below command to run the maven project.

$ mvn clean install -Prun 

It may take a while to run the project after that open a browser window. Then visit below URL


The source code of this project is available on GitHub.

· webscript, Java, alfresco