Building Alfresco ECM from scratch

This article show us how to build Alfresco from scratch which is useful when extending or bug fixing.

Alfresco ECM

Alfresco ECM


1. Windows XP
2. Java/JDK 1.6.0_21 (
3. Eclipse EE Helios SR2 (
4. Subversion plugin for Eclipse (downloaded from Eclipse Marketplace)
5. Apache Tomcat 6.0.32 (
7. ImageMagick 6.7.0-Q16 (
8. SWFTools 0.9.1 (
9. OpenOffice 3.2 (
10. Alfresco source code downloaded from SVN on 15/June.

Alfresco ECM: Community - version 4.0.0

Alfresco ECM: Community - version 4.0.0

Setup development environment:


1. Install JDK and set two system variables (JAVA_HOME and PATH):


Apache Tomcat

1. Install/Unzip Apache Tomcat in the folder above, for example, C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app

2. Create setenv.bat in C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app\bin file with the following content:

set JAVA_OPTS=-Xms256m -Xmx1024m -Xss96k -XX:MaxPermSize=256m -server


1. Unzip Eclipse into C:\1bpms-demo\eclipse-jee-helios-SR2.

2. Open Eclipse and install Subclipse plugin from Eclipse Marketplace.

3. Create a folder where will download and build the Alfresco source code, for exampleC:\1bpms-demo\alfresco_scratch.

4. Switch to “SVN Repository Exploring” perspective.
Create a new SVN repository location, enter svn:// as the URL, then click on “alfresco” folder and do checkout as project in the workspace.

5. Configure ANT runtime in Eclipse.
Go to Window > Preferences > Ant > Runtime > Properties and add 3 properties:


In my case, env.VIRTUAL_TOMCAT_HOME is an empty folder.

5. Create an ANT project.

– Select New > Project in the Eclipse toolbar. Under “General” choose “Project”.
– Right-click the project and choose New > File
– When the new file dialog box appears click the Advanced button and select “Link to file in the file system”.
– Browse to the build.xml file located in the HEAD\root directory.

MySQL, OpenOffice, SWFTools, ImageMagick and others

1. Install/Unzip MySQL (XAMPP) and create an empty database, for example:

create database alfresco;
grant all on alfresco.* to alfresco@localhost identified by 'alfresco';
grant all on alfresco.* to alfresco@localhost.localdomain identified by 'alfresco';

2. Install ImageMagick and SWFTools. Make sure you both exist in PATH system variable and you can run them from any place.

3. Install OpenOffice and make sure you can run it from any place.

4. Setup the Windows NetBios DLLs for CIFS Server:
Copy Win32Utils.dll and Win32NetBIOS.dll placed in (C:\2workspace\alfresco20110615\HEAD\root\projects\alfresco-jlan\jni) to the env.TOMCAT_HOME/bin folder.

Pre-configure Alfresco before building

1. Create the file alfresco-global.propertiesin C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app\shared\classes with the following content:

### database connection properties ###
### External executable locations ###

2. Copy mysql-connector-java-5.1.13-bin.jar to C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app\lib

3. Modify shared.loader property of the file with following value:



All targets for building Alfresco are within build.xml.
You can use ant -projecthelp to see all the available options. Here are a few of the common commands:

ant build-tomcat	builds and deploys Alfresco for Tomcat
ant incremental-tomcat	incrementally builds and deploys Alfresco for Tomcat
ant start-tomcat-application	executes the Tomcat start up script
ant build-jboss	builds and deploys Alfresco for JBoss
ant incremental-jboss	incrementally builds and deploys Alfresco for JBoss
ant start-jboss	executes the JBoss start up script
ant test	runs unit tests for the entire project

1. Run target “build-tomcat” from Eclipse.

2. Eclipse will create alfresco.war and share.war, they will be copied to webapps folder in Tomcat.

3. Now, Alfresco now is ready to be deployed.

Alfresco ECM deployed from Eclipse

Alfresco ECM deployed from Eclipse

Launch Tomcat/Alfresco

1. Run Tomcat from C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app\bin\startup.bat. Make sure MySQL is running before.

Alfresco database schema will be created and you will see all log of activity in the console.

2. If you want deploy/run alfresco from Eclipse:

In Eclipse add a new server instance from “C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app”.
Edit launch configuration properties of this server adding new VM arguments as:

-Xms256m -Xmx1024m -Xss96k -XX:MaxPermSize=256m -server 

Now, from Eclipse Server window run Tomcat instance.

Test Alfresco

Open a browser and go to http://localhost:8080/alfresco or http://localhost:8080/share and enter admin/admin as user/password.



Tagged with: ,
Posted in ECM
2 comments on “Building Alfresco ECM from scratch
  1. Chua Wen Ching says:

    Is Alfresco worth considering for its document management functionality? how does it difers with liferay document library?

    it looks almost alike except alfresco has the built-in document viewing (using the flash component – which won’t work on ipad) and workflow features.

    I just wonder whether it is worth the time to use Alfresco, any tips for me? Thanks.

    • Alfresco is a mature product, view documents on alfresco is a functionality in alfresco share using SWFTools (pdf2swf) and OpenOffice. This functionality is not for iPad/iPhone.
      In the future you can grab/upload videos or take picture from de Alfresco iOS app, when sending to alfresco repository you could share, comment, re-edit them, etc… obviously, you will need HTML5 to view these media files…. I hope there is some functionality to display flash here :)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: