Monday, December 3, 2012

How to setup an Alfresco Maven project in a few steps

 Install the tools and libraries
  1.  Install Maven (E.G. use 'sudo apt-get install maven2')
  2. Install Subversion (E.G. use 'sudo apt-get install subversion')
  3. Install the Subversion Java bindinds (E.G. use 'sudo apt-get install  libsvn-java)
 Install Eclipse and the required plug-ins (optional)
  1. Install Eclipse (you will need it as the I(ntegrated) D(evelopment) E(nvironment)
  2. Install the Eclipse Maven plug-in (The download site is ''
  3. Install the Subversion plug-in (The easisest is to enter subversion in the Eclipse Market Place)
  4. In Eclipse create a new workspace
Create the project for the repository extensions
  1.  Change the directory to the Eclipse workspace
  2. Then run the following command
mvn archetype:generate -DarchetypeGroupId=org.alfresco -DarchetypeArtifactId=maven-alfresco-amp-archetype \
-DarchetypeVersion=3.9.1 -DgroupId=${Your domain here, E.G. de.ecg} -DartifactId=${Your project name -repo here, E.G. my-repo} -Dversion=1.0-SNAPSHOT \
-DarchetypeRepository= -DinteractiveMode=false
 The above command contains 2 place holders. One specifies your domain the other one should name the project. For example the project 'my-repo' will be created.

Create the project for the Share extensions
  1.  Change the directory to the Eclipse workspace
  2. Then run the following command

mvn archetype:generate -DarchetypeGroupId=org.alfresco.maven -DarchetypeArtifactId=maven-alfresco-share-archetype \
-DarchetypeVersion=3.9.1 -DgroupId=${Your domain here} -DartifactId=${Your project name -share here} -Dversion=1.0-SNAPSHOT \
-DarchetypeRepository= -DinteractiveMode=false
Create the Eclipse projects
  1. Open Eclipse
  2. Click on 'Import -> Maven -> Existing Maven Project into Workspace'
  3. Navigate into the folder of the repo project and confirm
  4. The download of the several dependent artifacts / libraries to your local Maven cache may take a while
  5. Do the same for the Share project
A really cool and easy way to get an Alfresco project set up quite simpler than with ANT script. In the pom.xml you can see that the referenced Alfresco version is 4.0.2b which seems to be an older Community Edition release. An open question is how to setup a similar project for the Alfresco Enterprise Edition.


  1. If you should use the above mentioned command to create a repository extension then there seems to be an issue with Alfresco-s movement from HTTP to HTTPS for the artifacts repository. Just tried the steps from above again today without success. Alfresco replaced the amp plugin pom-file by a message which tells you that it was moved to the HTTPS repo. Unfortunately the resulting example project does not reflect that movement. So you have to edit the pom.xml of your 'my-repo' project by replacing with .

  2. There was meanwhile a new page created which explains quite all: . Here the steps:

    (1) Install Maven (ZIP distribution)
    (2) Install the JDK 7
    (3) Set the M3_HOME and JAVA_HOME environment variables by extending the PATH variable to use the bin subfolders
    (4) Try to run the command 'mvn' on the command line
    (5) Create a new project by using the AMP archetype
    (6) Build the empty project by using 'mvn install'
    (7) I think Netbeans is quite better than Eclipse to work directly with Maven projects. So you can just open the Maven project directly with Netbeans