Wednesday, September 12, 2007

Alfresco : Building from Source

Building Alfresco source code is quite simple, all the ant tasks are preconfigured and worked almost out of the box for me.

  1. Get the source code from Alfresco's repository by issuing this command
    c:> svn co svn://
    • For this command to work you will need svn (1.4.4 or higher) installed and in the path
    • Issue this command from the directory where you want your code. I have kept it in an eclipse workspace so I can import the projects in Eclipse later on.
  2. It takes about 3 - 4 hours (depending on you network speed) to get the entire source.
  3. Open the HEAD/root/ file and modify the home.tomcat variable. This should point to the tomcat installation which has the alfresco.war in its webapps. (In other words the tomcat that runs your alfresco). eg: F:/work/alfresco/tomcat. Save the file.
  4. From the HEAD/root directory issue the command c:/HEAD/root> ant
    • For this command to work you will need ant (1.6.5 or higher) installed and in the path. Its also handy to define a variable eg: ANT_HOME=F:\work\java\ant165 and then refer that in the path settings.
  5. It took about 45 minutes to fully compile.
  6. The build then goes on to delete the alfresco directory in tomcat/webapps (so make sure you have a backup of the webapps directory ... just in case). It will also replace the alfresco.war file with the newly built file.
  7. On the next start-up of the server the new alfresco.war will be deployed to the server. All repository and configuration information is maintained. This is ofcourse depending upon how much changes you have made in the shared folder v/s the WEB-INF folder.
That's about it. Please code responsibly. Don't Drink and Code ;-)


James McGovern said...

Don't you think it would be better if Alfresco simply packaged the source as one big download in zip format kinda like other open source projects?

eromanos said...

To avoid Out of Memory exceptions has to be modified.

Modify the line :

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

by the line :

JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx1024m -XX:MaxPermSize=256m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

Powered by Blogger.