Create a New Surf Application With One Command

Blog Post created by ddraper on Oct 5, 2012
This is going to be just a quick post to announce the availability of a new Spring Surf application archetype that is now available on artifacts.alfresco.com. I'd like to say a big thank you to my colleages Samuel Langlois and Gabriele Columbro for playing a huge part in making this happen!

It's now possible to create a new Surf application with one command (assuming that you have Maven 3 installed on your machine). Simply enter the following at a command prompt:

mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/archetype-catalog.xml

Select the 'spring-surf-archetype' (at the time of writing its number 8) and provide a 'groupId' and 'artifactId' when prompted (you can just hit enter to accept the defaults for the other options) and a new application will be created for you.

You can then build the application by running (in the folder created):

mvn install

And can then run the application with the following command:

mvn jetty:run

If you open your browser at the URL http://localhost:8080/<artifactId> then you'll see a sample Surf page.

The point of this archetype is twofold...

  1. It can give you a head start if you want to write your own web-client for working with your Alfresco repository

  2. As an educational tool to help you understand Surf applications (and therefore Alfresco Share) better

If you browse through the source of your new application you should find that all of the configuration files are heavily commented to explain what all the settings are for. There'll be more blog posts in the future with more information and examples of how to use the application but for now it should at least give you something to experiment with !