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

[caption id=”” align=”aligncenter” width=”236” caption=”Alfresco ECM”]Alfresco ECM[/caption]


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.

[caption id=”” align=”alignnone” width=”493” caption=”Alfresco ECM: Community - version 4.0.0”]Alfresco ECM: Community - version 4.0.0[/caption]

Setup development environment:


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

[sourcecode language=”text” gutter=”true” wraplines=”false”]


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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]
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 example C:\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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]

[/sourcecode] 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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]
create database alfresco;
grant all on alfresco.* to alfresco@localhost identified by ‘alfresco’;
grant all on alfresco.* to alfresco@localhost.localdomain identified by ‘alfresco’;

[/sourcecode] 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 in C:\1bpms-demo\alfresco_scratch\tomcat-6.0.32_app\shared\classes with the following content:

[sourcecode language=”text” gutter=”true” wraplines=”false”]

database connection properties

External executable locations


[/sourcecode] 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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]



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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]
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

[/sourcecode] 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.

[caption id=”” align=”alignnone” width=”631” caption=”Alfresco ECM deployed from Eclipse”]Alfresco ECM deployed from Eclipse[/caption]

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:

[sourcecode language=”text” gutter=”true” wraplines=”false”]
-Xms256m -Xmx1024m -Xss96k -XX:MaxPermSize=256m -server

[/sourcecode] 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. END.