This information applies to versions of Alfresco above 5.0.
Note: As of Alfresco Content Services 5.2.0, code checkout should be done from Git instead of SVN.
To build and run Alfresco on a development machine the following tools should be installed and working:
Java development kit (JDK), version 8
Apache Maven (version 3)
A database server. The default is PostgreSQL but any supported database may be used. A suitable user or schema owner must be created, as required by any Alfresco server (the default expectation is a user named alfresco)
This will build the Share web application (share.war). In addition this will build a share-enabled Alfresco server web application (alfresco.war). To do this, the maven build process will download the Alfresco platform war file (the Alfresco server without Share support built-in), build an amp (Alfresco server add-on package) containing the Share extensions and apply the amp to the Alfresco platform war file. The result is a war file that may be deployed in an application server — however, the Alfresco maven development environment also provides a method for automatically downloading and configuring an Apache Tomcat application server and deploying the Alfresco repository war file in it. It will also start a Solr server instance that will provide indexing and search capabilities.
After the build is complete you will see the following war files have been created:
Note that upon the first run, a standard Alfresco repository configuration file named alfresco-global.properties will be created in tomcat/shared/classes (where 'tomcat' is a sibling of the 'alfresco' directory). The file assumes the default setup of using a PostgreSQL database. To set up a different database, it is possible to create the file (allowing you to tweak the contents) without running the server:
mvn generate-resources -Prun
To run the Share UI, use a separate terminal window:
cd ../share mvn install -Prun
You should then be able to view the Share UI at the following URL:
Log in to Share using the username admin and password admin and from there you will be able to create sites, drag-and-drop files into the repository etc.
The content you create in the running repository will all be stored in the code-base/alfresco/runtime directory, along with entries in the chosen database. To start the server in a clean state (e.g. remove the binary content files, the Solr indexes and the database data), run the command as above, but with the addition of the purge profile:
mvn install -Ppurge,run
After stopping the tomcat process, it is possible to start it without rebuilding the project using the command:
Building and running the platform
To build just the platform (without any Share support) you will need to checkout the $PLATFORM code base:
Note that upon the first run, a standard Alfresco repository configuration file named alfresco-global.properties will be created in root/tomcat/shared/classes. The file assumes the default setup of using a PostgreSQL database. To set up a different database or override other settings change the properties in the file appropriately.
It is possible to run the embedded Tomcat with debugging enabled so that a debugger may be attached to the process (for example, using Eclipse). To do this, run mvnDebug instead of mvn when running the Tomcat instance. For example:
mvnDebug install -Prun
Debugging in Eclipse:
Create a debug profile
Select the appropriate project, e.g. for debugging the repository select that project.
Connection type: standard (socket attach)
You should now be able to halt on specific breakpoints.
Other IDEs will have similar mechanisms, please refer to their documentation for specific instructions.