Create a New Surf Application With One Command

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a New Surf Application With One Command

ddraper
Intermediate II
0 3 1,379
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 !
3 Comments
blog_commenter
Active Member
Hi, first of all many thanks for this blog entries. I tried the maven command and got stuck with the following :
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.springframework.extensions.surf:spring-surf-archetype:1.2.0-SNAPSHOT)

I'm wondering if it could come from the local checkout I made of se-surf project ?
ddraper
Intermediate II
Hi Mathieu,

You're right.... I'm now experiencing the same error (although I wasn't when I wrote the blog post). I'll look into the issue and get it resolved - thanks for bringing it to my attention.

Regards,
Dave
ddraper
Intermediate II
@Mathieu - it seems you need to explicitly reference the archetype-catalog.xml path.... I've updated the post, but please try the following command:

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

...that has fixed the problem for me,

Regards,
Dave