Alfresco SVN Development Environment
From AlfrescoWiki
Back to Developer Guide
See also: Developer Runtime Configuration
This page outlines the steps required to checkout the Alfresco Subversion Repository and setup a full development environment. This allows for the re-build of Alfresco which is useful when extending or bug fixing the Alfresco product itself.
This is the development environment used by Alfresco engineers.
Contents |
[edit] Extracting and building
Ensure the following software is installed:
- Java 1.5.x (supported version)
- Ant 1.6.5 or higher
- Subversion 1.3.x or higher
- MySQL 4.1.x or higher
- Tomcat 5.5.x (supported version) and/or JBoss Portal 2.0
- SWF Tools We use the latest Beta development build as it allows us to convert into SWF 9 format allowing us better control over the document when displayed in the 3.0 client. You need to add the location of pdf2swf to the PATH.
- Image Magick To convert images. Look here for installation instructions [1]
If you are using Tomcat, you will need to install two separate installations, one for Alfresco and one for virtualization.
Create the following environment variables to point to the appropriate folder:
- JAVA_HOME
- TOMCAT_HOME (can be used to host the Alfresco webapp)
- APP_TOMCAT_HOME (can be used to host the Slingshot webapp)
- JBOSS_HOME (can be used to host the Alfresco webapp)
- VIRTUAL_TOMCAT_HOME (NOTE: this must be a totally separate installation of Tomcat; it is required for virtualization)
You should also make sure that your [ANT]/bin directory and [Subversion]/bin directory are in your PATH.
Next, open a command window and execute the following commands (windows versions used, substitute your favourite shell if appropriate).
Create the MySQL database and user required to run the application:
mysqladmin -u root create alfresco mysql -u root -e "grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;" mysql -u root -e "grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;"
Create a new directory for Alfresco:
mkdir Alfresco cd Alfresco
Use Subversion to transfer the Alfresco source archive to your local disk, as per the instructions in the next section:
svn co svn://svn.alfresco.com/alfresco/HEAD
If you are working with version 2.0 or previous version, navigate into the root/common folder:
cd HEAD/root/common
If you are working with version 2.1 or higher, navigate to root instead:
cd HEAD/root
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 | 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 |
On Linux, you will need to install ImageMagick (http://www.imagemagick.org/script/binary-releases.php) and add a symbolic link, for example:
ln -s /usr/bin/convert /usr/bin/imconvert
Once the server has started, open a browser and go to http://localhost:8080/alfresco if you are running Tomcat or http://localhost:8080/portal if you are running JBoss and click on the Alfresco link on the left.
[edit] Subversion repository access
Public read-only access to the Alfresco Subversion repository is available from the web site.
- Install Subversion or Subeclipse and ensure that svn is on the path
- Checkout the HEAD of the code stream:
- Port 3690: svn co svn://svn.alfresco.com/alfresco/HEAD
- Port 80 : svn co http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD
- Keep up to date by issuing the command: svn update
Contributions are also welcome.
[edit] Eclipse projects
Each folder below the projects folder contains an Eclipse project that can be imported:
- Click File > Import.
- Click General > Existing Projects Into Workspace > Next.
- Click Browse and select a subdirectory of projects.
- Click Finish.
Note: Before importing these projects, make sure that Eclipse's JDK compiler compliance level is set to 5.0 within the Java > Compiler section of the Preferences screen.
The projects can be imported in the following order:
- 3rd-party - contains all 3rd party libraries (that is, jars) that Alfresco depends on, for example, Spring, Hibernate. Some of them are for build purposes only.
- core - contains low-level generic helper and utility classes, for example, configuration, error handling, i18n
- MBean - seen as mbeans in the SVN server.
- Deployment - the alfresco file system receiver FSR
- Alfresco JLAN - seen as alfresco-jlan in the SVN server.
- repository - contains the implementation of the Alfresco repository - the back-end services such as persistence, search, categorisation, transformation, and so on. Also provides the Repository Java API. Configured via Spring.
- remote-api - contains Alfresco's Web Services API - again a façade on top of the repository; a war file can be built from this project which provides the Web Services API but not the Alfresco Web Client.
- web-service-client - contains client-side Web Service connection code and helpers.
- jndi-client - used by the web-client project.
- web-client - contains the implementation of the Alfresco Web Client - the front-end web browser application built with JSF; contains HTML, JSP, Javascript, images, backing beans, in-line editors, and so on.
- webscript-framework - used by remote-api and web-client.
- Installer - contains the installer scripts for windows and Linux plus readme and license files.
- lang-packs - contains language translations as contributed by the community in the form of resource bundles.
- Extensions - contains support for plugging Alfresco into different environments, for example, Firefox, PHP.
- Netbios - a DLL that may be used by Alfresco's CIFS implementation for tight windows integration; implemented in C; it is very unlikely you will need to view the contents of this project.
- SDK ... - SDKs and example projects that demonstrate how to develop different types of Alfresco extension.
New in 2.1:
- deployment - contains Alfresco Deployment Receiver - used by deployment service in WCM module.
- link-validation - contains service to perform link validation checks in WCM module. Note that this depends on the Catalina-virtual project, so you need to import this first, before importing link-validation.
[edit] Running Ant from Eclipse
You can run the Ant targets mentioned above from within Eclipse. Firstly, you need to complete the following setup:
Create a new Simple Project (not a Java Project). I call mine Ant.
- Right click on the Ant project and select New > File.
- Click the Advanced button.
- Select the option Link to file in the filesystem.
- Browse for the build.xml file. If you expanded to c:\alfresco you need to browse to c:\alfresco\common, select build.xml and click the Open button.
- Enter build.xml in the File name field.
- Click Finish.
You should now see a link to build.xml in your Ant project. Double-click the file to see the contents. Eclipse also has several options to allow you to run targets in the file.
One way is to use the Outline window as it shows you all the targets in the project. Find the target you want to run and right click. Choose Run As > Ant build.
If you get errors because the environment variables, like TOMCAT_HOME, are not defined, then you can define them via Window > Preferences > Ant > Runtime > Properties and add env.TOMCAT_HOME.
If you really want to you can also debug the Ant script by placing a breakpoint in build.xml and choosing Debug As > Ant Build.
[edit] Developer Runtime Configuration
Before running Alfresco you may want to check the following common configuration options.
[edit] Windows NetBios DLLs for CIFS Server
If you are running on Windows and want to use CIFS, you also need to copy Win32Utils.dll and Win32NetBIOS.dll into the env.TOMCAT_HOME/bin. The Alfresco installer, which contains a copy of Tomcat already, has these DLLs in place but if you have been following these instructions and have installed Tomcat yourself, they will not be present.
The correct versions of the DLLs to copy can be found in SVN.
HEAD\root\projects\alfresco-jlan\jni

