AnsweredAssumed Answered

[Tutorial] Install Alfresco into Eclipse

Question asked by anirelles on Nov 15, 2008
Latest reply on Mar 28, 2017 by lipsa
Hi,

I wrote a document about setup Alfresco into Eclipse and run it. It is more detailed than what I found on Alfresco website
and maybe it can help. Don't hesitate to help me improve this document.

STEP by STEP TUTORIAL TO SET UP ALFRESCO IN ECLIPSE
+ BUILD AND LAUNCH ALFRESCO



PART 1 : SET UP ALFRESCO IN ECLIPSE


I) Install the plugin Subclipse in Eclipse


Help > Software Updates > Find and Install …

select “Search for new features to install”

select “New Remote Site”  
Name : Subclipse
URL : http://subclipse.tigris.org/update_1.4.x

follow until install Subclipse


II) Get Alfresco from SVN

create a directory called ALFRESCO_SVN into the directory workspaces of Eclipse

open Eclipse by selecting ALFRESCO_SVN as workspace directory

click : File > New > Project > SVN > Checkout Projects from SVN

choose “Create a new repository location” and use this URL : svn://svn.alfresco.com

Select the alfresco folder and click Next

Choose : “Check out as a project in the workspace” and click finish

III) Setup Eclipse

create a directory called ALFRESCO into the directory workspaces of Eclipse and switch Eclipse to this directory

Select : File > Import > General > Existing Projects into Workspace

In the dialog box select “Select Root Directory” and choose the directory “/workspace/ALFRESCO/alfresco/HEAD/root/projects”

Select all the projects except the ones starting with SDK (you don't need them to build Alfresco). Verify “Copy projects into workspace” is unchecked

Click Finish

When the import is finished build the workspace (note : after the compilation I had 42 errors, they didn't avoid the building of alfresco for me).


PART 2 : BUILD AND LAUNCH ALFRESCO


1) Install TOMCAT 5.5.x ( and not TOMCAT 6.x )


catalina.sh has to be modified to avoid Out of Memory exceptions.

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"


2) Install ImageMagick

It is necessary if you are using Linux. I don't know for Windows. I use Ubuntu and ImageMagick is present in the repositories.

3) Setup Mysql

Launch Mysql.

Create a database called “alfresco” (using PhpMyAdmin for example) and in a SQL editor execute :

grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;

4) Add a missing jar


Copy rt.jar (you can find it in jdk1.6.0_06/jre/lib) into workspace/ALFRESCO_SVN/alfresco/HEAD/root/projects/3rd-party/lib

5) Setup Ant into Eclipse

Note : it's a copy and paste from Alfresco website

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.
1.Right click on the Ant project and select New > File.
2.Click the Advanced button.
3.Select the option Link to file in the filesystem.
4.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.
5.Enter build.xml in the File name field.
6.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

5) Compile and deploy Alfresco

Right click build.xml and choose Run As > Ant Build

6) Access Alfresco

launch tomcat
access Alfresco at http://localhost:8080/alfresco
user : admin, password : admin

Outcomes