Thursday, December 27, 2007

Alfresco : Build Environment

How to setup Eclipse IDE for ECM projects.
Alfresco Development Setup
  1. Download form the customer portal alfresco-enterprise-tomcat-2.1.1.zip
  2. Make a folder {projectname} under your main drive.
  3. Create 2 folders under the {projectname} folder, workalfresco and deployalfresco.
  4. Extract the downloaded zip file in both these folders.
  5. Run Alfresco once before proceeding further.
  6. Download & Extract the SDK alfresco-enterprise-sdk-2.1.1.zip, in a temporary folder.
  7. Import the SDK in eclipse (Europa).
    • Create a new eclipse workspace. You can call it {projectname}EWS. (EWS stands for Eclipse WorkSpace).
    • Select File - Import..
    • General - Existing...
    • Select Root and Browse...
    • Browse to the the folder where the SDK was extracted.
    • Eclipse finds the projects that can be imported, the one that is required is SDKAlfrescoEmbedded. Although I typically select all, so that I can refer to source code examples.
    • Make sure that 'Copy projects into WorkSpace' is selected.
    • It will take some time for this activity to finish (have some coffee).

  8. Download the {projectname} project from Source Control, and configure it as a project in eclipse. Some teams like to share a zip file on ftp, extract it in temp folder and then import it as a project in eclipse. Just like above. If you are building from scratch then the {projectname} project will consist of the following directory structure...

The Build Process
  1. The build.xml file for this project does the work of building a jar file (for java classes) and a zip file containing both the jar above and the web resources like jsp, ftl, js, xml etc.
  2. In the middle of development if we need to reflect any change to the web resources only (those that do not need a restart of tomcat) then the ant target dev-refresh should be used.
  3. In case of a java or configuration xml change, the ant target dev-restart should be used, this will stop the running tomcat, compile and build all resources, inject the change in alfresco.war and starts tomcat
  4. NOTE: care should be taken for resource files that are deleted, as the build for dev does not start with a fresh war and will carry old, deleted files unless a fresh war is taken. This will not happen on production.
  5. So far everything is on the 'work' copy of alfresco and nothing on the deploy. Well the deploy is only for simulating production so the prod-restart ant target will do that. Make sure you have an old (the one that you started with for the first time) alfresco.war file with you.
  6. Here's how all the targets look like...

No comments :

Powered by Blogger.